cloudstructs 0.6.12 → 0.6.14
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 +3 -3
- package/assets/slack-app/provider.lambda/index.js +4 -5
- package/assets/slack-textract/detect.lambda/index.js +4 -5
- package/assets/ssl-server-test/analyze.lambda/index.js +4 -5
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.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 +3 -2
- package/node_modules/@types/cacheable-request/README.md +2 -2
- package/node_modules/@types/cacheable-request/package.json +5 -5
- package/node_modules/@types/keyv/README.md +16 -3
- package/node_modules/@types/keyv/index.d.ts +90 -0
- package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +961 -0
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +501 -0
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2258 -0
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1369 -0
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +410 -0
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3964 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +370 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +659 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dom-events.d.ts +126 -0
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +678 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1138 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3872 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +300 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1614 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2134 -0
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +541 -0
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +133 -0
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2741 -0
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +869 -0
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +466 -0
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +232 -0
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +625 -0
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1482 -0
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +143 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +653 -0
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +330 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1340 -0
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +374 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1028 -0
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +171 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/events.d.ts +678 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http.d.ts +1614 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/https.d.ts +541 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/module.d.ts +114 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +869 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/os.d.ts +466 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +374 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers/promises.d.ts +68 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/url.d.ts +897 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +1850 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +206 -0
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +897 -0
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1850 -0
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +396 -0
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +509 -0
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +689 -0
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/keyv/package.json +25 -5
- package/node_modules/keyv/README.md +23 -1
- package/node_modules/keyv/package.json +9 -8
- package/node_modules/keyv/src/index.d.ts +8 -1
- package/node_modules/keyv/src/index.js +4 -5
- package/package.json +7 -7
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `string_decoder` module provides an API for decoding `Buffer` objects into
|
|
3
|
+
* strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
|
|
4
|
+
* characters. It can be accessed using:
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* const { StringDecoder } = require('string_decoder');
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* The following example shows the basic use of the `StringDecoder` class.
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* const { StringDecoder } = require('string_decoder');
|
|
14
|
+
* const decoder = new StringDecoder('utf8');
|
|
15
|
+
*
|
|
16
|
+
* const cent = Buffer.from([0xC2, 0xA2]);
|
|
17
|
+
* console.log(decoder.write(cent));
|
|
18
|
+
*
|
|
19
|
+
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
|
|
20
|
+
* console.log(decoder.write(euro));
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* When a `Buffer` instance is written to the `StringDecoder` instance, an
|
|
24
|
+
* internal buffer is used to ensure that the decoded string does not contain
|
|
25
|
+
* any incomplete multibyte characters. These are held in the buffer until the
|
|
26
|
+
* next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
|
|
27
|
+
*
|
|
28
|
+
* In the following example, the three UTF-8 encoded bytes of the European Euro
|
|
29
|
+
* symbol (`€`) are written over three separate operations:
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* const { StringDecoder } = require('string_decoder');
|
|
33
|
+
* const decoder = new StringDecoder('utf8');
|
|
34
|
+
*
|
|
35
|
+
* decoder.write(Buffer.from([0xE2]));
|
|
36
|
+
* decoder.write(Buffer.from([0x82]));
|
|
37
|
+
* console.log(decoder.end(Buffer.from([0xAC])));
|
|
38
|
+
* ```
|
|
39
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/string_decoder.js)
|
|
40
|
+
*/
|
|
41
|
+
declare module 'string_decoder' {
|
|
42
|
+
class StringDecoder {
|
|
43
|
+
constructor(encoding?: BufferEncoding);
|
|
44
|
+
/**
|
|
45
|
+
* Returns a decoded string, ensuring that any incomplete multibyte characters at
|
|
46
|
+
* the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
|
|
47
|
+
* returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
|
|
48
|
+
* @since v0.1.99
|
|
49
|
+
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
|
|
50
|
+
*/
|
|
51
|
+
write(buffer: Buffer): string;
|
|
52
|
+
/**
|
|
53
|
+
* Returns any remaining input stored in the internal buffer as a string. Bytes
|
|
54
|
+
* representing incomplete UTF-8 and UTF-16 characters will be replaced with
|
|
55
|
+
* substitution characters appropriate for the character encoding.
|
|
56
|
+
*
|
|
57
|
+
* If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
|
|
58
|
+
* After `end()` is called, the `stringDecoder` object can be reused for new input.
|
|
59
|
+
* @since v0.9.3
|
|
60
|
+
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
|
|
61
|
+
*/
|
|
62
|
+
end(buffer?: Buffer): string;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
declare module 'node:string_decoder' {
|
|
66
|
+
export * from 'string_decoder';
|
|
67
|
+
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `node:test` module provides a standalone testing module.
|
|
3
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.8.0/lib/test.js)
|
|
4
|
+
*/
|
|
5
|
+
declare module 'node:test' {
|
|
6
|
+
/**
|
|
7
|
+
* Programmatically start the test runner.
|
|
8
|
+
* @since v18.9.0
|
|
9
|
+
* @param options Configuration options for running tests.
|
|
10
|
+
* @returns A {@link TapStream} that emits events about the test execution.
|
|
11
|
+
*/
|
|
12
|
+
function run(options?: RunOptions): TapStream;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
16
|
+
* function results in the creation of a test point in the TAP output.
|
|
17
|
+
*
|
|
18
|
+
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
|
19
|
+
* related to the current test. Examples include skipping the test, adding additional TAP
|
|
20
|
+
* diagnostic information, or creating subtests.
|
|
21
|
+
*
|
|
22
|
+
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
|
23
|
+
* can usually be discarded for top level tests. However, the return value from subtests should
|
|
24
|
+
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
|
25
|
+
* in the following example.
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* test('top level test', async (t) => {
|
|
29
|
+
* // The setTimeout() in the following subtest would cause it to outlive its
|
|
30
|
+
* // parent test if 'await' is removed on the next line. Once the parent test
|
|
31
|
+
* // completes, it will cancel any outstanding subtests.
|
|
32
|
+
* await t.test('longer running subtest', async (t) => {
|
|
33
|
+
* return new Promise((resolve, reject) => {
|
|
34
|
+
* setTimeout(resolve, 1000);
|
|
35
|
+
* });
|
|
36
|
+
* });
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
* @since v18.0.0
|
|
40
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
41
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
42
|
+
* @param options Configuration options for the test
|
|
43
|
+
* @param fn The function under test. The first argument to this function is a
|
|
44
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
45
|
+
* passed as the second argument. Default: A no-op function.
|
|
46
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
47
|
+
*/
|
|
48
|
+
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
49
|
+
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
50
|
+
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
51
|
+
function test(fn?: TestFn): Promise<void>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @since v18.6.0
|
|
55
|
+
* @param name The name of the suite, which is displayed when reporting suite results.
|
|
56
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
57
|
+
* @param options Configuration options for the suite
|
|
58
|
+
* @param fn The function under suite. Default: A no-op function.
|
|
59
|
+
*/
|
|
60
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
|
|
61
|
+
function describe(name?: string, fn?: SuiteFn): void;
|
|
62
|
+
function describe(options?: TestOptions, fn?: SuiteFn): void;
|
|
63
|
+
function describe(fn?: SuiteFn): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since v18.6.0
|
|
67
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
68
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
69
|
+
* @param options Configuration options for the test
|
|
70
|
+
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
71
|
+
* passed as the second argument. Default: A no-op function.
|
|
72
|
+
*/
|
|
73
|
+
function it(name?: string, options?: TestOptions, fn?: ItFn): void;
|
|
74
|
+
function it(name?: string, fn?: ItFn): void;
|
|
75
|
+
function it(options?: TestOptions, fn?: ItFn): void;
|
|
76
|
+
function it(fn?: ItFn): void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The type of a function under test. The first argument to this function is a
|
|
80
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
81
|
+
* the second argument.
|
|
82
|
+
*/
|
|
83
|
+
type TestFn = (t: TestContext, done: (result?: any) => void) => any;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The type of a function under Suite.
|
|
87
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
88
|
+
*/
|
|
89
|
+
type SuiteFn = (done: (result?: any) => void) => void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The type of a function under test.
|
|
93
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
94
|
+
*/
|
|
95
|
+
type ItFn = (done: (result?: any) => void) => any;
|
|
96
|
+
|
|
97
|
+
interface RunOptions {
|
|
98
|
+
/**
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
concurrency?: number | boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An array containing the list of files to run. If unspecified, the test runner execution model will be used.
|
|
105
|
+
*/
|
|
106
|
+
files?: readonly string[];
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Allows aborting an in-progress test.
|
|
110
|
+
* @default undefined
|
|
111
|
+
*/
|
|
112
|
+
signal?: AbortSignal;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A number of milliseconds the test will fail after. If unspecified, subtests inherit this
|
|
116
|
+
* value from their parent.
|
|
117
|
+
* @default Infinity
|
|
118
|
+
*/
|
|
119
|
+
timeout?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A successful call of the run() method will return a new TapStream object, streaming a TAP output.
|
|
124
|
+
* TapStream will emit events in the order of the tests' definitions.
|
|
125
|
+
* @since v18.9.0
|
|
126
|
+
*/
|
|
127
|
+
interface TapStream extends NodeJS.ReadableStream {
|
|
128
|
+
addListener(event: 'test:diagnostic', listener: (message: string) => void): this;
|
|
129
|
+
addListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
130
|
+
addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
131
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
132
|
+
emit(event: 'test:diagnostic', message: string): boolean;
|
|
133
|
+
emit(event: 'test:fail', data: TestFail): boolean;
|
|
134
|
+
emit(event: 'test:pass', data: TestPass): boolean;
|
|
135
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
136
|
+
on(event: 'test:diagnostic', listener: (message: string) => void): this;
|
|
137
|
+
on(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
138
|
+
on(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
139
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
140
|
+
once(event: 'test:diagnostic', listener: (message: string) => void): this;
|
|
141
|
+
once(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
142
|
+
once(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
143
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
144
|
+
prependListener(event: 'test:diagnostic', listener: (message: string) => void): this;
|
|
145
|
+
prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
146
|
+
prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
147
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
148
|
+
prependOnceListener(event: 'test:diagnostic', listener: (message: string) => void): this;
|
|
149
|
+
prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
150
|
+
prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
151
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface TestFail {
|
|
155
|
+
/**
|
|
156
|
+
* The test duration.
|
|
157
|
+
*/
|
|
158
|
+
duration: number;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The failure casing test to fail.
|
|
162
|
+
*/
|
|
163
|
+
error: Error;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The test name.
|
|
167
|
+
*/
|
|
168
|
+
name: string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The ordinal number of the test.
|
|
172
|
+
*/
|
|
173
|
+
testNumber: number;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Present if `context.todo` is called.
|
|
177
|
+
*/
|
|
178
|
+
todo?: string;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Present if `context.skip` is called.
|
|
182
|
+
*/
|
|
183
|
+
skip?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface TestPass {
|
|
187
|
+
/**
|
|
188
|
+
* The test duration.
|
|
189
|
+
*/
|
|
190
|
+
duration: number;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The test name.
|
|
194
|
+
*/
|
|
195
|
+
name: string;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The ordinal number of the test.
|
|
199
|
+
*/
|
|
200
|
+
testNumber: number;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Present if `context.todo` is called.
|
|
204
|
+
*/
|
|
205
|
+
todo?: string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Present if `context.skip` is called.
|
|
209
|
+
*/
|
|
210
|
+
skip?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
215
|
+
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
216
|
+
* @since v18.0.0
|
|
217
|
+
*/
|
|
218
|
+
interface TestContext {
|
|
219
|
+
/**
|
|
220
|
+
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
|
221
|
+
* included at the end of the test's results. This function does not return a value.
|
|
222
|
+
* @param message Message to be displayed as a TAP diagnostic.
|
|
223
|
+
* @since v18.0.0
|
|
224
|
+
*/
|
|
225
|
+
diagnostic(message: string): void;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
|
229
|
+
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
|
230
|
+
* command-line option, this function is a no-op.
|
|
231
|
+
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
|
232
|
+
* @since v18.0.0
|
|
233
|
+
*/
|
|
234
|
+
runOnly(shouldRunOnlyTests: boolean): void;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* This function causes the test's output to indicate the test as skipped. If `message` is
|
|
238
|
+
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
|
|
239
|
+
* the test function. This function does not return a value.
|
|
240
|
+
* @param message Optional skip message to be displayed in TAP output.
|
|
241
|
+
* @since v18.0.0
|
|
242
|
+
*/
|
|
243
|
+
skip(message?: string): void;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
|
|
247
|
+
* included in the TAP output. Calling `todo()` does not terminate execution of the test
|
|
248
|
+
* function. This function does not return a value.
|
|
249
|
+
* @param message Optional `TODO` message to be displayed in TAP output.
|
|
250
|
+
* @since v18.0.0
|
|
251
|
+
*/
|
|
252
|
+
todo(message?: string): void;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* This function is used to create subtests under the current test. This function behaves in
|
|
256
|
+
* the same fashion as the top level {@link test} function.
|
|
257
|
+
* @since v18.0.0
|
|
258
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
259
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
260
|
+
* @param options Configuration options for the test
|
|
261
|
+
* @param fn The function under test. This first argument to this function is a
|
|
262
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
263
|
+
* passed as the second argument. Default: A no-op function.
|
|
264
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
265
|
+
*/
|
|
266
|
+
test: typeof test;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
interface TestOptions {
|
|
270
|
+
/**
|
|
271
|
+
* The number of tests that can be run at the same time. If unspecified, subtests inherit this
|
|
272
|
+
* value from their parent.
|
|
273
|
+
* @default 1
|
|
274
|
+
*/
|
|
275
|
+
concurrency?: number;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* If truthy, and the test context is configured to run `only` tests, then this test will be
|
|
279
|
+
* run. Otherwise, the test is skipped.
|
|
280
|
+
* @default false
|
|
281
|
+
*/
|
|
282
|
+
only?: boolean;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Allows aborting an in-progress test.
|
|
286
|
+
* @since v18.8.0
|
|
287
|
+
*/
|
|
288
|
+
signal?: AbortSignal;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* If truthy, the test is skipped. If a string is provided, that string is displayed in the
|
|
292
|
+
* test results as the reason for skipping the test.
|
|
293
|
+
* @default false
|
|
294
|
+
*/
|
|
295
|
+
skip?: boolean | string;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* A number of milliseconds the test will fail after. If unspecified, subtests inherit this
|
|
299
|
+
* value from their parent.
|
|
300
|
+
* @default Infinity
|
|
301
|
+
* @since v18.7.0
|
|
302
|
+
*/
|
|
303
|
+
timeout?: number;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
|
|
307
|
+
* the test results as the reason why the test is `TODO`.
|
|
308
|
+
* @default false
|
|
309
|
+
*/
|
|
310
|
+
todo?: boolean | string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* This function is used to create a hook running before running a suite.
|
|
315
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
316
|
+
* the second argument. Default: A no-op function.
|
|
317
|
+
* @param options Configuration options for the hook.
|
|
318
|
+
* @since v18.8.0
|
|
319
|
+
*/
|
|
320
|
+
function before(fn?: HookFn, options?: HookOptions): void;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* This function is used to create a hook running after running a suite.
|
|
324
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
325
|
+
* the second argument. Default: A no-op function.
|
|
326
|
+
* @param options Configuration options for the hook.
|
|
327
|
+
* @since v18.8.0
|
|
328
|
+
*/
|
|
329
|
+
function after(fn?: HookFn, options?: HookOptions): void;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* This function is used to create a hook running before each subtest of the current suite.
|
|
333
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
334
|
+
* the second argument. Default: A no-op function.
|
|
335
|
+
* @param options Configuration options for the hook.
|
|
336
|
+
* @since v18.8.0
|
|
337
|
+
*/
|
|
338
|
+
function beforeEach(fn?: HookFn, options?: HookOptions): void;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* This function is used to create a hook running after each subtest of the current test.
|
|
342
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
343
|
+
* the second argument. Default: A no-op function.
|
|
344
|
+
* @param options Configuration options for the hook.
|
|
345
|
+
* @since v18.8.0
|
|
346
|
+
*/
|
|
347
|
+
function afterEach(fn?: HookFn, options?: HookOptions): void;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The hook function. If the hook uses callbacks, the callback function is passed as the
|
|
351
|
+
* second argument.
|
|
352
|
+
*/
|
|
353
|
+
type HookFn = (done: (result?: any) => void) => any;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Configuration options for hooks.
|
|
357
|
+
* @since v18.8.0
|
|
358
|
+
*/
|
|
359
|
+
interface HookOptions {
|
|
360
|
+
/**
|
|
361
|
+
* Allows aborting an in-progress hook.
|
|
362
|
+
*/
|
|
363
|
+
signal?: AbortSignal;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* A number of milliseconds the hook will fail after. If unspecified, subtests inherit this
|
|
367
|
+
* value from their parent.
|
|
368
|
+
* @default Infinity
|
|
369
|
+
*/
|
|
370
|
+
timeout?: number;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach };
|
|
374
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
+
* that return `Promise` objects. The API is accessible via`require('timers/promises')`.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* import {
|
|
7
|
+
* setTimeout,
|
|
8
|
+
* setImmediate,
|
|
9
|
+
* setInterval,
|
|
10
|
+
* } from 'timers/promises';
|
|
11
|
+
* ```
|
|
12
|
+
* @since v15.0.0
|
|
13
|
+
*/
|
|
14
|
+
declare module 'timers/promises' {
|
|
15
|
+
import { TimerOptions } from 'node:timers';
|
|
16
|
+
/**
|
|
17
|
+
* ```js
|
|
18
|
+
* import {
|
|
19
|
+
* setTimeout,
|
|
20
|
+
* } from 'timers/promises';
|
|
21
|
+
*
|
|
22
|
+
* const res = await setTimeout(100, 'result');
|
|
23
|
+
*
|
|
24
|
+
* console.log(res); // Prints 'result'
|
|
25
|
+
* ```
|
|
26
|
+
* @since v15.0.0
|
|
27
|
+
* @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
|
|
28
|
+
* @param value A value with which the promise is fulfilled.
|
|
29
|
+
*/
|
|
30
|
+
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* ```js
|
|
33
|
+
* import {
|
|
34
|
+
* setImmediate,
|
|
35
|
+
* } from 'timers/promises';
|
|
36
|
+
*
|
|
37
|
+
* const res = await setImmediate('result');
|
|
38
|
+
*
|
|
39
|
+
* console.log(res); // Prints 'result'
|
|
40
|
+
* ```
|
|
41
|
+
* @since v15.0.0
|
|
42
|
+
* @param value A value with which the promise is fulfilled.
|
|
43
|
+
*/
|
|
44
|
+
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns an async iterator that generates values in an interval of `delay` ms.
|
|
47
|
+
*
|
|
48
|
+
* ```js
|
|
49
|
+
* import {
|
|
50
|
+
* setInterval,
|
|
51
|
+
* } from 'timers/promises';
|
|
52
|
+
*
|
|
53
|
+
* const interval = 100;
|
|
54
|
+
* for await (const startTime of setInterval(interval, Date.now())) {
|
|
55
|
+
* const now = Date.now();
|
|
56
|
+
* console.log(now);
|
|
57
|
+
* if ((now - startTime) > 1000)
|
|
58
|
+
* break;
|
|
59
|
+
* }
|
|
60
|
+
* console.log(Date.now());
|
|
61
|
+
* ```
|
|
62
|
+
* @since v15.9.0
|
|
63
|
+
*/
|
|
64
|
+
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
|
|
65
|
+
}
|
|
66
|
+
declare module 'node:timers/promises' {
|
|
67
|
+
export * from 'timers/promises';
|
|
68
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `timer` module exposes a global API for scheduling functions to
|
|
3
|
+
* be called at some future period of time. Because the timer functions are
|
|
4
|
+
* globals, there is no need to call `require('timers')` to use the API.
|
|
5
|
+
*
|
|
6
|
+
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
|
+
* provided by Web Browsers but use a different internal implementation that is
|
|
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/v18.0.0/lib/timers.js)
|
|
10
|
+
*/
|
|
11
|
+
declare module 'timers' {
|
|
12
|
+
import { Abortable } from 'node:events';
|
|
13
|
+
import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
|
|
14
|
+
interface TimerOptions extends Abortable {
|
|
15
|
+
/**
|
|
16
|
+
* Set to `false` to indicate that the scheduled `Timeout`
|
|
17
|
+
* should not require the Node.js event loop to remain active.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
ref?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
let setTimeout: typeof global.setTimeout;
|
|
23
|
+
let clearTimeout: typeof global.clearTimeout;
|
|
24
|
+
let setInterval: typeof global.setInterval;
|
|
25
|
+
let clearInterval: typeof global.clearInterval;
|
|
26
|
+
let setImmediate: typeof global.setImmediate;
|
|
27
|
+
let clearImmediate: typeof global.clearImmediate;
|
|
28
|
+
global {
|
|
29
|
+
namespace NodeJS {
|
|
30
|
+
// compatibility with older typings
|
|
31
|
+
interface Timer extends RefCounted {
|
|
32
|
+
hasRef(): boolean;
|
|
33
|
+
refresh(): this;
|
|
34
|
+
[Symbol.toPrimitive](): number;
|
|
35
|
+
}
|
|
36
|
+
interface Immediate extends RefCounted {
|
|
37
|
+
/**
|
|
38
|
+
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
39
|
+
* @since v11.0.0
|
|
40
|
+
*/
|
|
41
|
+
hasRef(): boolean;
|
|
42
|
+
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
43
|
+
}
|
|
44
|
+
interface Timeout extends Timer {
|
|
45
|
+
/**
|
|
46
|
+
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
47
|
+
* @since v11.0.0
|
|
48
|
+
*/
|
|
49
|
+
hasRef(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the timer's start time to the current time, and reschedules the timer to
|
|
52
|
+
* call its callback at the previously specified duration adjusted to the current
|
|
53
|
+
* time. This is useful for refreshing a timer without allocating a new
|
|
54
|
+
* JavaScript object.
|
|
55
|
+
*
|
|
56
|
+
* Using this on a timer that has already called its callback will reactivate the
|
|
57
|
+
* timer.
|
|
58
|
+
* @since v10.2.0
|
|
59
|
+
* @return a reference to `timeout`
|
|
60
|
+
*/
|
|
61
|
+
refresh(): this;
|
|
62
|
+
[Symbol.toPrimitive](): number;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
66
|
+
// util.promisify no rest args compability
|
|
67
|
+
// tslint:disable-next-line void-return
|
|
68
|
+
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
69
|
+
namespace setTimeout {
|
|
70
|
+
const __promisify__: typeof setTimeoutPromise;
|
|
71
|
+
}
|
|
72
|
+
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
73
|
+
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
|
74
|
+
// util.promisify no rest args compability
|
|
75
|
+
// tslint:disable-next-line void-return
|
|
76
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
|
|
77
|
+
namespace setInterval {
|
|
78
|
+
const __promisify__: typeof setIntervalPromise;
|
|
79
|
+
}
|
|
80
|
+
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
81
|
+
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
|
82
|
+
// util.promisify no rest args compability
|
|
83
|
+
// tslint:disable-next-line void-return
|
|
84
|
+
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
|
|
85
|
+
namespace setImmediate {
|
|
86
|
+
const __promisify__: typeof setImmediatePromise;
|
|
87
|
+
}
|
|
88
|
+
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
|
89
|
+
function queueMicrotask(callback: () => void): void;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
declare module 'node:timers' {
|
|
93
|
+
export * from 'timers';
|
|
94
|
+
}
|