cloudstructs 0.9.30 → 0.9.32
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 +4 -4
- package/assets/slack-textract/detect.lambda/index.js +5 -6
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/dmarc/index.js +1 -1
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/mjml-template/index.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-app/manifest.js +1 -1
- package/lib/slack-app/slack-app.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/ssl-server-test/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/index.js +1 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@babel/runtime/helpers/esm/tsRewriteRelativeImportExtensions.js +6 -0
- package/node_modules/@babel/runtime/helpers/tsRewriteRelativeImportExtensions.js +6 -0
- package/node_modules/@babel/runtime/package.json +10 -1
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +28 -18
- package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +3 -1
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +50 -5
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +4 -4
- package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +28 -0
- package/node_modules/@slack/logger/node_modules/@types/node/sqlite.d.ts +63 -17
- package/node_modules/@slack/logger/node_modules/@types/node/stream/consumers.d.ts +32 -6
- package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +82 -0
- package/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +24 -13
- package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +159 -112
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +23 -10
- package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +1 -0
- package/node_modules/@slack/logger/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/node_modules/@slack/logger/node_modules/undici-types/package.json +1 -1
- package/node_modules/@slack/logger/node_modules/undici-types/readable.d.ts +5 -0
- package/node_modules/@slack/logger/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.js +3 -4
- package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +28 -18
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/https.d.ts +3 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +50 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +28 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +63 -17
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/consumers.d.ts +32 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +82 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/timers/promises.d.ts +24 -13
- package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +159 -112
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +23 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/undici-types/package.json +1 -1
- package/node_modules/@slack/web-api/node_modules/undici-types/readable.d.ts +5 -0
- package/node_modules/@slack/web-api/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@slack/web-api/package.json +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +28 -18
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +3 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +50 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +28 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/sqlite.d.ts +63 -17
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +32 -6
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +82 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +24 -13
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +159 -112
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +23 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +1 -0
- package/node_modules/@types/cacheable-request/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/node_modules/@types/cacheable-request/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/cacheable-request/node_modules/undici-types/readable.d.ts +5 -0
- package/node_modules/@types/cacheable-request/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +28 -18
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +3 -1
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +50 -5
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +28 -0
- package/node_modules/@types/keyv/node_modules/@types/node/sqlite.d.ts +63 -17
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +32 -6
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +82 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +24 -13
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +159 -112
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +23 -10
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/keyv/node_modules/undici-types/readable.d.ts +5 -0
- package/node_modules/@types/keyv/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +28 -18
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +3 -1
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +50 -5
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +28 -0
- package/node_modules/@types/responselike/node_modules/@types/node/sqlite.d.ts +63 -17
- package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +32 -6
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +82 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +24 -13
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +159 -112
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +23 -10
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +1 -0
- package/node_modules/@types/responselike/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/node_modules/@types/responselike/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/responselike/node_modules/undici-types/readable.d.ts +5 -0
- package/node_modules/@types/responselike/node_modules/undici-types/webidl.d.ts +6 -0
- package/package.json +20 -20
|
@@ -147,6 +147,7 @@ declare module "node:test" {
|
|
|
147
147
|
export {
|
|
148
148
|
after,
|
|
149
149
|
afterEach,
|
|
150
|
+
assert,
|
|
150
151
|
before,
|
|
151
152
|
beforeEach,
|
|
152
153
|
describe,
|
|
@@ -753,6 +754,18 @@ declare module "node:test" {
|
|
|
753
754
|
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
754
755
|
*/
|
|
755
756
|
test: typeof test;
|
|
757
|
+
/**
|
|
758
|
+
* This method polls a `condition` function until that function either returns
|
|
759
|
+
* successfully or the operation times out.
|
|
760
|
+
* @since v22.14.0
|
|
761
|
+
* @param condition An assertion function that is invoked
|
|
762
|
+
* periodically until it completes successfully or the defined polling timeout
|
|
763
|
+
* elapses. Successful completion is defined as not throwing or rejecting. This
|
|
764
|
+
* function does not accept any arguments, and is allowed to return any value.
|
|
765
|
+
* @param options An optional configuration object for the polling operation.
|
|
766
|
+
* @returns Fulfilled with the value returned by `condition`.
|
|
767
|
+
*/
|
|
768
|
+
waitFor<T>(condition: () => T, options?: TestContextWaitForOptions): Promise<Awaited<T>>;
|
|
756
769
|
/**
|
|
757
770
|
* Each test provides its own MockTracker instance.
|
|
758
771
|
*/
|
|
@@ -781,6 +794,33 @@ declare module "node:test" {
|
|
|
781
794
|
| "throws"
|
|
782
795
|
>
|
|
783
796
|
{
|
|
797
|
+
/**
|
|
798
|
+
* This function serializes `value` and writes it to the file specified by `path`.
|
|
799
|
+
*
|
|
800
|
+
* ```js
|
|
801
|
+
* test('snapshot test with default serialization', (t) => {
|
|
802
|
+
* t.assert.fileSnapshot({ value1: 1, value2: 2 }, './snapshots/snapshot.json');
|
|
803
|
+
* });
|
|
804
|
+
* ```
|
|
805
|
+
*
|
|
806
|
+
* This function differs from `context.assert.snapshot()` in the following ways:
|
|
807
|
+
*
|
|
808
|
+
* * The snapshot file path is explicitly provided by the user.
|
|
809
|
+
* * Each snapshot file is limited to a single snapshot value.
|
|
810
|
+
* * No additional escaping is performed by the test runner.
|
|
811
|
+
*
|
|
812
|
+
* These differences allow snapshot files to better support features such as syntax
|
|
813
|
+
* highlighting.
|
|
814
|
+
* @since v22.14.0
|
|
815
|
+
* @param value A value to serialize to a string. If Node.js was started with
|
|
816
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots)
|
|
817
|
+
* flag, the serialized value is written to
|
|
818
|
+
* `path`. Otherwise, the serialized value is compared to the contents of the
|
|
819
|
+
* existing snapshot file.
|
|
820
|
+
* @param path The file where the serialized `value` is written.
|
|
821
|
+
* @param options Optional configuration options.
|
|
822
|
+
*/
|
|
823
|
+
fileSnapshot(value: any, path: string, options?: AssertSnapshotOptions): void;
|
|
784
824
|
/**
|
|
785
825
|
* This function implements assertions for snapshot testing.
|
|
786
826
|
* ```js
|
|
@@ -795,8 +835,17 @@ declare module "node:test" {
|
|
|
795
835
|
* });
|
|
796
836
|
* ```
|
|
797
837
|
* @since v22.3.0
|
|
838
|
+
* @param value A value to serialize to a string. If Node.js was started with
|
|
839
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots)
|
|
840
|
+
* flag, the serialized value is written to
|
|
841
|
+
* the snapshot file. Otherwise, the serialized value is compared to the
|
|
842
|
+
* corresponding value in the existing snapshot file.
|
|
798
843
|
*/
|
|
799
844
|
snapshot(value: any, options?: AssertSnapshotOptions): void;
|
|
845
|
+
/**
|
|
846
|
+
* A custom assertion function registered with `assert.register()`.
|
|
847
|
+
*/
|
|
848
|
+
[name: string]: (...args: any[]) => void;
|
|
800
849
|
}
|
|
801
850
|
interface AssertSnapshotOptions {
|
|
802
851
|
/**
|
|
@@ -809,6 +858,20 @@ declare module "node:test" {
|
|
|
809
858
|
*/
|
|
810
859
|
serializers?: ReadonlyArray<(value: any) => any> | undefined;
|
|
811
860
|
}
|
|
861
|
+
interface TestContextWaitForOptions {
|
|
862
|
+
/**
|
|
863
|
+
* The number of milliseconds to wait after an unsuccessful
|
|
864
|
+
* invocation of `condition` before trying again.
|
|
865
|
+
* @default 50
|
|
866
|
+
*/
|
|
867
|
+
interval?: number | undefined;
|
|
868
|
+
/**
|
|
869
|
+
* The poll timeout in milliseconds. If `condition` has not
|
|
870
|
+
* succeeded by the time this elapses, an error occurs.
|
|
871
|
+
* @default 1000
|
|
872
|
+
*/
|
|
873
|
+
timeout?: number | undefined;
|
|
874
|
+
}
|
|
812
875
|
|
|
813
876
|
/**
|
|
814
877
|
* An instance of `SuiteContext` is passed to each suite function in order to
|
|
@@ -1594,6 +1657,24 @@ declare module "node:test" {
|
|
|
1594
1657
|
*/
|
|
1595
1658
|
[Symbol.dispose](): void;
|
|
1596
1659
|
}
|
|
1660
|
+
/**
|
|
1661
|
+
* An object whose methods are used to configure available assertions on the
|
|
1662
|
+
* `TestContext` objects in the current process. The methods from `node:assert`
|
|
1663
|
+
* and snapshot testing functions are available by default.
|
|
1664
|
+
*
|
|
1665
|
+
* It is possible to apply the same configuration to all files by placing common
|
|
1666
|
+
* configuration code in a module
|
|
1667
|
+
* preloaded with `--require` or `--import`.
|
|
1668
|
+
* @since v22.14.0
|
|
1669
|
+
*/
|
|
1670
|
+
namespace assert {
|
|
1671
|
+
/**
|
|
1672
|
+
* Defines a new assertion function with the provided name and function. If an
|
|
1673
|
+
* assertion already exists with the same name, it is overwritten.
|
|
1674
|
+
* @since v22.14.0
|
|
1675
|
+
*/
|
|
1676
|
+
function register(name: string, fn: (this: TestContext, ...args: any[]) => void): void;
|
|
1677
|
+
}
|
|
1597
1678
|
/**
|
|
1598
1679
|
* @since v22.3.0
|
|
1599
1680
|
*/
|
|
@@ -1625,6 +1706,7 @@ declare module "node:test" {
|
|
|
1625
1706
|
export {
|
|
1626
1707
|
after,
|
|
1627
1708
|
afterEach,
|
|
1709
|
+
assert,
|
|
1628
1710
|
before,
|
|
1629
1711
|
beforeEach,
|
|
1630
1712
|
describe,
|
|
@@ -1,6 +1,7 @@
|
|
|
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 {
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
* } from 'node:timers/promises';
|
|
11
12
|
* ```
|
|
12
13
|
* @since v15.0.0
|
|
14
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers/promises.js)
|
|
13
15
|
*/
|
|
14
16
|
declare module "timers/promises" {
|
|
15
17
|
import { TimerOptions } from "node:timers";
|
|
@@ -24,7 +26,8 @@ declare module "timers/promises" {
|
|
|
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>;
|
|
@@ -62,33 +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
|
/**
|
|
69
|
-
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
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.
|
|
70
77
|
*
|
|
71
|
-
* Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent
|
|
72
|
-
*
|
|
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.
|
|
73
81
|
*
|
|
74
82
|
* ```js
|
|
75
83
|
* import { scheduler } from 'node:timers/promises';
|
|
76
84
|
*
|
|
77
85
|
* await scheduler.wait(1000); // Wait one second before continuing
|
|
78
86
|
* ```
|
|
79
|
-
* @since v16.14.0
|
|
87
|
+
* @since v17.3.0, v16.14.0
|
|
80
88
|
* @experimental
|
|
81
|
-
* @param
|
|
89
|
+
* @param delay The number of milliseconds to wait before resolving the
|
|
90
|
+
* promise.
|
|
82
91
|
*/
|
|
83
|
-
wait
|
|
92
|
+
wait(delay: number, options?: { signal?: AbortSignal }): Promise<void>;
|
|
84
93
|
/**
|
|
85
|
-
* An experimental API defined by the [Scheduling APIs](https://
|
|
94
|
+
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
86
95
|
* being developed as a standard Web Platform API.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
96
|
+
*
|
|
97
|
+
* Calling `timersPromises.scheduler.yield()` is equivalent to calling
|
|
98
|
+
* `timersPromises.setImmediate()` with no arguments.
|
|
99
|
+
* @since v17.3.0, v16.14.0
|
|
89
100
|
* @experimental
|
|
90
101
|
*/
|
|
91
|
-
yield
|
|
102
|
+
yield(): Promise<void>;
|
|
92
103
|
}
|
|
93
104
|
const scheduler: Scheduler;
|
|
94
105
|
}
|
|
@@ -10,12 +10,8 @@
|
|
|
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,59 @@ 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
|
|
63
|
+
* @experimental
|
|
78
64
|
*/
|
|
79
65
|
[Symbol.dispose](): void;
|
|
66
|
+
_onImmediate(...args: any[]): void;
|
|
67
|
+
}
|
|
68
|
+
// Legacy interface used in Node.js v9 and prior
|
|
69
|
+
// TODO: remove in a future major version bump
|
|
70
|
+
/** @deprecated Use `NodeJS.Timeout` instead. */
|
|
71
|
+
interface Timer extends RefCounted {
|
|
72
|
+
hasRef(): boolean;
|
|
73
|
+
refresh(): this;
|
|
74
|
+
[Symbol.toPrimitive](): number;
|
|
80
75
|
}
|
|
81
76
|
/**
|
|
82
|
-
* This object is created internally and is returned from `setTimeout()` and
|
|
83
|
-
*
|
|
77
|
+
* This object is created internally and is returned from `setTimeout()` and
|
|
78
|
+
* `setInterval()`. It can be passed to either `clearTimeout()` or
|
|
79
|
+
* `clearInterval()` in order to cancel the scheduled actions.
|
|
84
80
|
*
|
|
85
|
-
* By default, when a timer is scheduled using either `setTimeout()` or
|
|
81
|
+
* By default, when a timer is scheduled using either `setTimeout()` or
|
|
82
|
+
* `setInterval()`, the Node.js event loop will continue running as long as the
|
|
86
83
|
* timer is active. Each of the `Timeout` objects returned by these functions
|
|
87
84
|
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
|
|
88
85
|
* control this default behavior.
|
|
89
86
|
*/
|
|
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;
|
|
87
|
+
interface Timeout extends RefCounted, Disposable, Timer {
|
|
100
88
|
/**
|
|
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.
|
|
89
|
+
* Cancels the timeout.
|
|
104
90
|
* @since v0.9.1
|
|
105
|
-
* @
|
|
91
|
+
* @legacy Use `clearTimeout()` instead.
|
|
92
|
+
* @returns a reference to `timeout`
|
|
106
93
|
*/
|
|
107
|
-
|
|
94
|
+
close(): this;
|
|
108
95
|
/**
|
|
109
96
|
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
110
97
|
* @since v11.0.0
|
|
111
98
|
*/
|
|
112
99
|
hasRef(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
102
|
+
* `Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
103
|
+
*
|
|
104
|
+
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
105
|
+
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
106
|
+
* @since v0.9.1
|
|
107
|
+
* @returns a reference to `timeout`
|
|
108
|
+
*/
|
|
109
|
+
ref(): this;
|
|
113
110
|
/**
|
|
114
111
|
* Sets the timer's start time to the current time, and reschedules the timer to
|
|
115
112
|
* call its callback at the previously specified duration adjusted to the current
|
|
@@ -119,121 +116,171 @@ declare module "timers" {
|
|
|
119
116
|
* Using this on a timer that has already called its callback will reactivate the
|
|
120
117
|
* timer.
|
|
121
118
|
* @since v10.2.0
|
|
122
|
-
* @
|
|
119
|
+
* @returns a reference to `timeout`
|
|
123
120
|
*/
|
|
124
121
|
refresh(): this;
|
|
122
|
+
/**
|
|
123
|
+
* When called, the active `Timeout` object will not require the Node.js event loop
|
|
124
|
+
* to remain active. If there is no other activity keeping the event loop running,
|
|
125
|
+
* the process may exit before the `Timeout` object's callback is invoked. Calling
|
|
126
|
+
* `timeout.unref()` multiple times will have no effect.
|
|
127
|
+
* @since v0.9.1
|
|
128
|
+
* @returns a reference to `timeout`
|
|
129
|
+
*/
|
|
130
|
+
unref(): this;
|
|
131
|
+
/**
|
|
132
|
+
* Coerce a `Timeout` to a primitive. The primitive can be used to
|
|
133
|
+
* clear the `Timeout`. The primitive can only be used in the
|
|
134
|
+
* same thread where the timeout was created. Therefore, to use it
|
|
135
|
+
* across `worker_threads` it must first be passed to the correct
|
|
136
|
+
* thread. This allows enhanced compatibility with browser
|
|
137
|
+
* `setTimeout()` and `setInterval()` implementations.
|
|
138
|
+
* @since v14.9.0, v12.19.0
|
|
139
|
+
*/
|
|
125
140
|
[Symbol.toPrimitive](): number;
|
|
126
141
|
/**
|
|
127
142
|
* Cancels the timeout.
|
|
128
|
-
* @since v20.5.0
|
|
143
|
+
* @since v20.5.0, v18.18.0
|
|
144
|
+
* @experimental
|
|
129
145
|
*/
|
|
130
146
|
[Symbol.dispose](): void;
|
|
147
|
+
_onTimeout(...args: any[]): void;
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
150
|
/**
|
|
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.
|
|
151
|
+
* Schedules the "immediate" execution of the `callback` after I/O events'
|
|
152
|
+
* callbacks.
|
|
140
153
|
*
|
|
141
|
-
* When
|
|
154
|
+
* When multiple calls to `setImmediate()` are made, the `callback` functions are
|
|
155
|
+
* queued for execution in the order in which they are created. The entire callback
|
|
156
|
+
* queue is processed every event loop iteration. If an immediate timer is queued
|
|
157
|
+
* from inside an executing callback, that timer will not be triggered until the
|
|
158
|
+
* next event loop iteration.
|
|
142
159
|
*
|
|
143
160
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
144
161
|
*
|
|
145
|
-
* This method has a custom variant for promises that is available using
|
|
146
|
-
*
|
|
147
|
-
* @
|
|
148
|
-
* @param
|
|
162
|
+
* This method has a custom variant for promises that is available using
|
|
163
|
+
* `timersPromises.setImmediate()`.
|
|
164
|
+
* @since v0.9.1
|
|
165
|
+
* @param callback The function to call at the end of this turn of
|
|
166
|
+
* the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout)
|
|
149
167
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
150
|
-
* @
|
|
168
|
+
* @returns for use with `clearImmediate()`
|
|
151
169
|
*/
|
|
152
|
-
function
|
|
170
|
+
function setImmediate<TArgs extends any[]>(
|
|
153
171
|
callback: (...args: TArgs) => void,
|
|
154
|
-
ms?: number,
|
|
155
172
|
...args: TArgs
|
|
156
|
-
): NodeJS.
|
|
157
|
-
//
|
|
173
|
+
): NodeJS.Immediate;
|
|
174
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
175
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
158
176
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
159
|
-
function
|
|
160
|
-
namespace
|
|
161
|
-
|
|
177
|
+
function setImmediate(callback: (_: void) => void): NodeJS.Immediate;
|
|
178
|
+
namespace setImmediate {
|
|
179
|
+
import __promisify__ = promises.setImmediate;
|
|
180
|
+
export { __promisify__ };
|
|
162
181
|
}
|
|
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
182
|
/**
|
|
170
183
|
* Schedules repeated execution of `callback` every `delay` milliseconds.
|
|
171
184
|
*
|
|
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.
|
|
185
|
+
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
|
|
186
|
+
* will be set to `1`. Non-integer delays are truncated to an integer.
|
|
174
187
|
*
|
|
175
188
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
176
189
|
*
|
|
177
|
-
* This method has a custom variant for promises that is available using
|
|
190
|
+
* This method has a custom variant for promises that is available using
|
|
191
|
+
* `timersPromises.setInterval()`.
|
|
178
192
|
* @since v0.0.1
|
|
179
193
|
* @param callback The function to call when the timer elapses.
|
|
180
|
-
* @param
|
|
194
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
195
|
+
* `callback`. **Default:** `1`.
|
|
181
196
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
182
|
-
* @
|
|
197
|
+
* @returns for use with `clearInterval()`
|
|
183
198
|
*/
|
|
184
199
|
function setInterval<TArgs extends any[]>(
|
|
185
200
|
callback: (...args: TArgs) => void,
|
|
186
|
-
|
|
201
|
+
delay?: number,
|
|
187
202
|
...args: TArgs
|
|
188
203
|
): NodeJS.Timeout;
|
|
189
|
-
//
|
|
204
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
205
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
190
206
|
// 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;
|
|
207
|
+
function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
201
208
|
/**
|
|
202
|
-
* Schedules
|
|
203
|
-
* callbacks.
|
|
209
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
204
210
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
211
|
+
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
212
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
213
|
+
* nor of their ordering. The callback will be called as close as possible to the
|
|
214
|
+
* time specified.
|
|
215
|
+
*
|
|
216
|
+
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
|
|
217
|
+
* will be set to `1`. Non-integer delays are truncated to an integer.
|
|
210
218
|
*
|
|
211
219
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
212
220
|
*
|
|
213
|
-
* This method has a custom variant for promises that is available using
|
|
214
|
-
*
|
|
215
|
-
* @
|
|
221
|
+
* This method has a custom variant for promises that is available using
|
|
222
|
+
* `timersPromises.setTimeout()`.
|
|
223
|
+
* @since v0.0.1
|
|
224
|
+
* @param callback The function to call when the timer elapses.
|
|
225
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
226
|
+
* `callback`. **Default:** `1`.
|
|
216
227
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
217
|
-
* @
|
|
228
|
+
* @returns for use with `clearTimeout()`
|
|
218
229
|
*/
|
|
219
|
-
function
|
|
230
|
+
function setTimeout<TArgs extends any[]>(
|
|
220
231
|
callback: (...args: TArgs) => void,
|
|
232
|
+
delay?: number,
|
|
221
233
|
...args: TArgs
|
|
222
|
-
): NodeJS.
|
|
223
|
-
//
|
|
234
|
+
): NodeJS.Timeout;
|
|
235
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
236
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
224
237
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
225
|
-
function
|
|
226
|
-
namespace
|
|
227
|
-
|
|
238
|
+
function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
239
|
+
namespace setTimeout {
|
|
240
|
+
import __promisify__ = promises.setTimeout;
|
|
241
|
+
export { __promisify__ };
|
|
228
242
|
}
|
|
229
243
|
/**
|
|
230
244
|
* Cancels an `Immediate` object created by `setImmediate()`.
|
|
231
245
|
* @since v0.9.1
|
|
232
|
-
* @param immediate An `Immediate` object as returned by
|
|
246
|
+
* @param immediate An `Immediate` object as returned by `setImmediate()`.
|
|
247
|
+
*/
|
|
248
|
+
function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
|
|
249
|
+
/**
|
|
250
|
+
* Cancels a `Timeout` object created by `setInterval()`.
|
|
251
|
+
* @since v0.0.1
|
|
252
|
+
* @param timeout A `Timeout` object as returned by `setInterval()`
|
|
253
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
254
|
+
*/
|
|
255
|
+
function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
256
|
+
/**
|
|
257
|
+
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
258
|
+
* @since v0.0.1
|
|
259
|
+
* @param timeout A `Timeout` object as returned by `setTimeout()`
|
|
260
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
261
|
+
*/
|
|
262
|
+
function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
263
|
+
/**
|
|
264
|
+
* The `queueMicrotask()` method queues a microtask to invoke `callback`. If
|
|
265
|
+
* `callback` throws an exception, the `process` object `'uncaughtException'`
|
|
266
|
+
* event will be emitted.
|
|
267
|
+
*
|
|
268
|
+
* The microtask queue is managed by V8 and may be used in a similar manner to
|
|
269
|
+
* the `process.nextTick()` queue, which is managed by Node.js. The
|
|
270
|
+
* `process.nextTick()` queue is always processed before the microtask queue
|
|
271
|
+
* within each turn of the Node.js event loop.
|
|
272
|
+
* @since v11.0.0
|
|
273
|
+
* @param callback Function to be queued.
|
|
233
274
|
*/
|
|
234
|
-
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
|
235
275
|
function queueMicrotask(callback: () => void): void;
|
|
236
276
|
}
|
|
277
|
+
import clearImmediate = globalThis.clearImmediate;
|
|
278
|
+
import clearInterval = globalThis.clearInterval;
|
|
279
|
+
import clearTimeout = globalThis.clearTimeout;
|
|
280
|
+
import setImmediate = globalThis.setImmediate;
|
|
281
|
+
import setInterval = globalThis.setInterval;
|
|
282
|
+
import setTimeout = globalThis.setTimeout;
|
|
283
|
+
export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
|
|
237
284
|
}
|
|
238
285
|
declare module "node:timers" {
|
|
239
286
|
export * from "timers";
|