cdk-common 2.0.583 → 2.0.585
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/lib/main.js +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +35 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +22 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/events.d.ts +35 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/fs/promises.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/net.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/stream.d.ts +762 -728
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/test.d.ts +86 -48
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +35 -0
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +22 -2
- package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/events.d.ts +35 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/fs/promises.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/net.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/stream.d.ts +762 -728
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/test.d.ts +86 -48
- package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/package.json +2 -2
|
@@ -162,33 +162,33 @@ declare module 'node:test' {
|
|
|
162
162
|
* @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object.
|
|
163
163
|
* @return Immediately fulfilled with `undefined`.
|
|
164
164
|
*/
|
|
165
|
-
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
166
|
-
function describe(name?: string, fn?: SuiteFn): void
|
|
167
|
-
function describe(options?: TestOptions, fn?: SuiteFn): void
|
|
168
|
-
function describe(fn?: SuiteFn): void
|
|
165
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
166
|
+
function describe(name?: string, fn?: SuiteFn): Promise<void>;
|
|
167
|
+
function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
168
|
+
function describe(fn?: SuiteFn): Promise<void>;
|
|
169
169
|
namespace describe {
|
|
170
170
|
/**
|
|
171
171
|
* Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
|
|
172
172
|
*/
|
|
173
|
-
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
174
|
-
function skip(name?: string, fn?: SuiteFn): void
|
|
175
|
-
function skip(options?: TestOptions, fn?: SuiteFn): void
|
|
176
|
-
function skip(fn?: SuiteFn): void
|
|
173
|
+
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
174
|
+
function skip(name?: string, fn?: SuiteFn): Promise<void>;
|
|
175
|
+
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
176
|
+
function skip(fn?: SuiteFn): Promise<void>;
|
|
177
177
|
/**
|
|
178
178
|
* Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
|
|
179
179
|
*/
|
|
180
|
-
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
181
|
-
function todo(name?: string, fn?: SuiteFn): void
|
|
182
|
-
function todo(options?: TestOptions, fn?: SuiteFn): void
|
|
183
|
-
function todo(fn?: SuiteFn): void
|
|
180
|
+
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
181
|
+
function todo(name?: string, fn?: SuiteFn): Promise<void>;
|
|
182
|
+
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
183
|
+
function todo(fn?: SuiteFn): Promise<void>;
|
|
184
184
|
/**
|
|
185
185
|
* Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
|
|
186
186
|
* @since v18.15.0
|
|
187
187
|
*/
|
|
188
|
-
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
189
|
-
function only(name?: string, fn?: SuiteFn): void
|
|
190
|
-
function only(options?: TestOptions, fn?: SuiteFn): void
|
|
191
|
-
function only(fn?: SuiteFn): void
|
|
188
|
+
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
189
|
+
function only(name?: string, fn?: SuiteFn): Promise<void>;
|
|
190
|
+
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
191
|
+
function only(fn?: SuiteFn): Promise<void>;
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
194
|
* Shorthand for `test()`.
|
|
@@ -196,69 +196,79 @@ declare module 'node:test' {
|
|
|
196
196
|
* The `it()` function is imported from the `node:test` module.
|
|
197
197
|
* @since v18.6.0, v16.17.0
|
|
198
198
|
*/
|
|
199
|
-
function it(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
200
|
-
function it(name?: string, fn?: TestFn): void
|
|
201
|
-
function it(options?: TestOptions, fn?: TestFn): void
|
|
202
|
-
function it(fn?: TestFn): void
|
|
199
|
+
function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
200
|
+
function it(name?: string, fn?: TestFn): Promise<void>;
|
|
201
|
+
function it(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
202
|
+
function it(fn?: TestFn): Promise<void>;
|
|
203
203
|
namespace it {
|
|
204
204
|
/**
|
|
205
205
|
* Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
|
|
206
206
|
*/
|
|
207
|
-
function skip(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
208
|
-
function skip(name?: string, fn?: TestFn): void
|
|
209
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
210
|
-
function skip(fn?: TestFn): void
|
|
207
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
208
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
209
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
210
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
211
211
|
/**
|
|
212
212
|
* Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
|
|
213
213
|
*/
|
|
214
|
-
function todo(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
215
|
-
function todo(name?: string, fn?: TestFn): void
|
|
216
|
-
function todo(options?: TestOptions, fn?: TestFn): void
|
|
217
|
-
function todo(fn?: TestFn): void
|
|
214
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
215
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
216
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
217
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
218
218
|
/**
|
|
219
219
|
* Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
|
|
220
220
|
* @since v18.15.0
|
|
221
221
|
*/
|
|
222
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
223
|
-
function only(name?: string, fn?: TestFn): void
|
|
224
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
225
|
-
function only(fn?: TestFn): void
|
|
222
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
223
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
224
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
225
|
+
function only(fn?: TestFn): Promise<void>;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
|
|
229
229
|
* @since v20.2.0
|
|
230
230
|
*/
|
|
231
|
-
function skip(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
232
|
-
function skip(name?: string, fn?: TestFn): void
|
|
233
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
234
|
-
function skip(fn?: TestFn): void
|
|
231
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
232
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
233
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
234
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
235
235
|
/**
|
|
236
236
|
* Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
|
|
237
237
|
* @since v20.2.0
|
|
238
238
|
*/
|
|
239
|
-
function todo(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
240
|
-
function todo(name?: string, fn?: TestFn): void
|
|
241
|
-
function todo(options?: TestOptions, fn?: TestFn): void
|
|
242
|
-
function todo(fn?: TestFn): void
|
|
239
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
240
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
241
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
242
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
243
243
|
/**
|
|
244
244
|
* Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
|
|
245
245
|
* @since v20.2.0
|
|
246
246
|
*/
|
|
247
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
248
|
-
function only(name?: string, fn?: TestFn): void
|
|
249
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
250
|
-
function only(fn?: TestFn): void
|
|
247
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
248
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
249
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
250
|
+
function only(fn?: TestFn): Promise<void>;
|
|
251
251
|
/**
|
|
252
252
|
* The type of a function under test. The first argument to this function is a
|
|
253
253
|
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
254
254
|
* the second argument.
|
|
255
255
|
*/
|
|
256
|
-
type TestFn = (t: TestContext, done: (result?: any) => void) =>
|
|
256
|
+
type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
|
|
257
257
|
/**
|
|
258
258
|
* The type of a function under Suite.
|
|
259
259
|
* If the test uses callbacks, the callback function is passed as an argument
|
|
260
260
|
*/
|
|
261
|
-
type SuiteFn = (
|
|
261
|
+
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
|
|
262
|
+
interface TestShard {
|
|
263
|
+
/**
|
|
264
|
+
* A positive integer between 1 and `<total>` that specifies the index of the shard to run.
|
|
265
|
+
*/
|
|
266
|
+
index: number;
|
|
267
|
+
/**
|
|
268
|
+
* A positive integer that specifies the total number of shards to split the test files to.
|
|
269
|
+
*/
|
|
270
|
+
total: number;
|
|
271
|
+
}
|
|
262
272
|
interface RunOptions {
|
|
263
273
|
/**
|
|
264
274
|
* If a number is provided, then that many files would run in parallel.
|
|
@@ -301,9 +311,15 @@ declare module 'node:test' {
|
|
|
301
311
|
*/
|
|
302
312
|
setup?: (root: unknown) => void | Promise<void>;
|
|
303
313
|
/**
|
|
304
|
-
* Whether to run in watch mode or not.
|
|
314
|
+
* Whether to run in watch mode or not.
|
|
315
|
+
* @default false
|
|
316
|
+
*/
|
|
317
|
+
watch?: boolean | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Running tests in a specific shard.
|
|
320
|
+
* @default undefined
|
|
305
321
|
*/
|
|
306
|
-
|
|
322
|
+
shard?: TestShard | undefined;
|
|
307
323
|
}
|
|
308
324
|
class Test extends AsyncResource {
|
|
309
325
|
concurrency: number;
|
|
@@ -504,6 +520,24 @@ declare module 'node:test' {
|
|
|
504
520
|
*/
|
|
505
521
|
readonly mock: MockTracker;
|
|
506
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* An instance of `SuiteContext` is passed to each suite function in order to
|
|
525
|
+
* interact with the test runner. However, the `SuiteContext` constructor is not
|
|
526
|
+
* exposed as part of the API.
|
|
527
|
+
* @since v18.7.0, v16.17.0
|
|
528
|
+
*/
|
|
529
|
+
class SuiteContext {
|
|
530
|
+
/**
|
|
531
|
+
* The name of the suite.
|
|
532
|
+
* @since v18.8.0, v16.18.0
|
|
533
|
+
*/
|
|
534
|
+
readonly name: string;
|
|
535
|
+
/**
|
|
536
|
+
* Can be used to abort test subtasks when the test has been aborted.
|
|
537
|
+
* @since v18.7.0, v16.17.0
|
|
538
|
+
*/
|
|
539
|
+
readonly signal: AbortSignal;
|
|
540
|
+
}
|
|
507
541
|
interface TestOptions {
|
|
508
542
|
/**
|
|
509
543
|
* If a number is provided, then that many tests would run in parallel.
|
|
@@ -1192,6 +1226,10 @@ declare module 'node:test' {
|
|
|
1192
1226
|
* @since v20.4.0
|
|
1193
1227
|
*/
|
|
1194
1228
|
runAll(): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* Calls {@link MockTimers.reset()}.
|
|
1231
|
+
*/
|
|
1232
|
+
[Symbol.dispose](): void;
|
|
1195
1233
|
}
|
|
1196
1234
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };
|
|
1197
1235
|
}
|
|
@@ -68,6 +68,11 @@ declare module 'timers' {
|
|
|
68
68
|
*/
|
|
69
69
|
hasRef(): boolean;
|
|
70
70
|
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
71
|
+
/**
|
|
72
|
+
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
|
73
|
+
* @since v20.5.0
|
|
74
|
+
*/
|
|
75
|
+
[Symbol.dispose](): void;
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
78
|
* This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
|
|
@@ -114,6 +119,11 @@ declare module 'timers' {
|
|
|
114
119
|
*/
|
|
115
120
|
refresh(): this;
|
|
116
121
|
[Symbol.toPrimitive](): number;
|
|
122
|
+
/**
|
|
123
|
+
* Cancels the timeout.
|
|
124
|
+
* @since v20.5.0
|
|
125
|
+
*/
|
|
126
|
+
[Symbol.dispose](): void;
|
|
117
127
|
}
|
|
118
128
|
}
|
|
119
129
|
/**
|
|
@@ -163,10 +173,10 @@ declare module 'timers' {
|
|
|
163
173
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
164
174
|
* @return for use with {@link clearInterval}
|
|
165
175
|
*/
|
|
166
|
-
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.
|
|
176
|
+
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
167
177
|
// util.promisify no rest args compability
|
|
168
178
|
// tslint:disable-next-line void-return
|
|
169
|
-
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.
|
|
179
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
170
180
|
namespace setInterval {
|
|
171
181
|
const __promisify__: typeof setIntervalPromise;
|
|
172
182
|
}
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sun, 13 Aug 2023 19:32:51 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -302,6 +302,11 @@ declare module 'child_process' {
|
|
|
302
302
|
* @since v0.1.90
|
|
303
303
|
*/
|
|
304
304
|
kill(signal?: NodeJS.Signals | number): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Calls {@link ChildProcess.kill} with `'SIGTERM'`.
|
|
307
|
+
* @since v20.5.0
|
|
308
|
+
*/
|
|
309
|
+
[Symbol.dispose](): void;
|
|
305
310
|
/**
|
|
306
311
|
* When an IPC channel has been established between the parent and child (
|
|
307
312
|
* i.e. when using {@link fork}), the `subprocess.send()` method can
|
|
@@ -538,6 +538,11 @@ declare module 'dgram' {
|
|
|
538
538
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
539
539
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
540
540
|
prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
|
541
|
+
/**
|
|
542
|
+
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
|
543
|
+
* @since v20.5.0
|
|
544
|
+
*/
|
|
545
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
541
546
|
}
|
|
542
547
|
}
|
|
543
548
|
declare module 'node:dgram' {
|
|
@@ -338,6 +338,41 @@ declare module 'events' {
|
|
|
338
338
|
* objects.
|
|
339
339
|
*/
|
|
340
340
|
static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
|
|
341
|
+
/**
|
|
342
|
+
* Listens once to the `abort` event on the provided `signal`.
|
|
343
|
+
*
|
|
344
|
+
* Listening to the `abort` event on abort signals is unsafe and may
|
|
345
|
+
* lead to resource leaks since another third party with the signal can
|
|
346
|
+
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
|
|
347
|
+
* this since it would violate the web standard. Additionally, the original
|
|
348
|
+
* API makes it easy to forget to remove listeners.
|
|
349
|
+
*
|
|
350
|
+
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
|
|
351
|
+
* two issues by listening to the event such that `stopImmediatePropagation` does
|
|
352
|
+
* not prevent the listener from running.
|
|
353
|
+
*
|
|
354
|
+
* Returns a disposable so that it may be unsubscribed from more easily.
|
|
355
|
+
*
|
|
356
|
+
* ```js
|
|
357
|
+
* import { addAbortListener } from 'node:events';
|
|
358
|
+
*
|
|
359
|
+
* function example(signal) {
|
|
360
|
+
* let disposable;
|
|
361
|
+
* try {
|
|
362
|
+
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
|
|
363
|
+
* disposable = addAbortListener(signal, (e) => {
|
|
364
|
+
* // Do something when signal is aborted.
|
|
365
|
+
* });
|
|
366
|
+
* } finally {
|
|
367
|
+
* disposable?.[Symbol.dispose]();
|
|
368
|
+
* }
|
|
369
|
+
* }
|
|
370
|
+
* ```
|
|
371
|
+
* @since v20.5.0
|
|
372
|
+
* @experimental
|
|
373
|
+
* @return that removes the `abort` listener.
|
|
374
|
+
*/
|
|
375
|
+
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
|
341
376
|
/**
|
|
342
377
|
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
|
|
343
378
|
*
|
|
@@ -456,6 +456,11 @@ declare module 'fs/promises' {
|
|
|
456
456
|
* @return Fulfills with `undefined` upon success.
|
|
457
457
|
*/
|
|
458
458
|
close(): Promise<void>;
|
|
459
|
+
/**
|
|
460
|
+
* An alias for {@link FileHandle.close()}.
|
|
461
|
+
* @since v20.4.0
|
|
462
|
+
*/
|
|
463
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
459
464
|
}
|
|
460
465
|
const constants: typeof fsConstants;
|
|
461
466
|
/**
|
|
@@ -84,6 +84,28 @@ declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal:
|
|
|
84
84
|
};
|
|
85
85
|
//#endregion borrowed
|
|
86
86
|
|
|
87
|
+
//#region Disposable
|
|
88
|
+
interface SymbolConstructor {
|
|
89
|
+
/**
|
|
90
|
+
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
|
|
91
|
+
*/
|
|
92
|
+
readonly dispose: unique symbol;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
|
|
96
|
+
*/
|
|
97
|
+
readonly asyncDispose: unique symbol;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface Disposable {
|
|
101
|
+
[Symbol.dispose](): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface AsyncDisposable {
|
|
105
|
+
[Symbol.asyncDispose](): PromiseLike<void>;
|
|
106
|
+
}
|
|
107
|
+
//#endregion Disposable
|
|
108
|
+
|
|
87
109
|
//#region ArrayLike.at()
|
|
88
110
|
interface RelativeIndexable<T> {
|
|
89
111
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 20.
|
|
1
|
+
// Type definitions for non-npm package Node.js 20.5
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -639,6 +639,11 @@ declare module 'net' {
|
|
|
639
639
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
640
640
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
641
641
|
prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
642
|
+
/**
|
|
643
|
+
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
|
644
|
+
* @since v20.5.0
|
|
645
|
+
*/
|
|
646
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
642
647
|
}
|
|
643
648
|
type IPVersion = 'ipv4' | 'ipv6';
|
|
644
649
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.5.0",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -227,6 +227,6 @@
|
|
|
227
227
|
},
|
|
228
228
|
"scripts": {},
|
|
229
229
|
"dependencies": {},
|
|
230
|
-
"typesPublisherContentHash": "
|
|
230
|
+
"typesPublisherContentHash": "83e291a6a60ec56a2b56b6b885ae9a0ea199888a482d63f4a22270483f82f2a9",
|
|
231
231
|
"typeScriptVersion": "4.3"
|
|
232
232
|
}
|
|
@@ -477,6 +477,11 @@ declare module 'stream' {
|
|
|
477
477
|
removeListener(event: 'resume', listener: () => void): this;
|
|
478
478
|
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
479
479
|
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
480
|
+
/**
|
|
481
|
+
* Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.
|
|
482
|
+
* @since v20.4.0
|
|
483
|
+
*/
|
|
484
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
480
485
|
}
|
|
481
486
|
import WritableOptions = internal.WritableOptions;
|
|
482
487
|
class WritableBase extends Stream implements NodeJS.WritableStream {
|
|
@@ -259,6 +259,16 @@ declare module 'node:test' {
|
|
|
259
259
|
* If the test uses callbacks, the callback function is passed as an argument
|
|
260
260
|
*/
|
|
261
261
|
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
|
|
262
|
+
interface TestShard {
|
|
263
|
+
/**
|
|
264
|
+
* A positive integer between 1 and `<total>` that specifies the index of the shard to run.
|
|
265
|
+
*/
|
|
266
|
+
index: number;
|
|
267
|
+
/**
|
|
268
|
+
* A positive integer that specifies the total number of shards to split the test files to.
|
|
269
|
+
*/
|
|
270
|
+
total: number;
|
|
271
|
+
}
|
|
262
272
|
interface RunOptions {
|
|
263
273
|
/**
|
|
264
274
|
* If a number is provided, then that many files would run in parallel.
|
|
@@ -301,9 +311,15 @@ declare module 'node:test' {
|
|
|
301
311
|
*/
|
|
302
312
|
setup?: (root: Test) => void | Promise<void>;
|
|
303
313
|
/**
|
|
304
|
-
* Whether to run in watch mode or not.
|
|
314
|
+
* Whether to run in watch mode or not.
|
|
315
|
+
* @default false
|
|
305
316
|
*/
|
|
306
|
-
watch?: boolean;
|
|
317
|
+
watch?: boolean | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Running tests in a specific shard.
|
|
320
|
+
* @default undefined
|
|
321
|
+
*/
|
|
322
|
+
shard?: TestShard | undefined;
|
|
307
323
|
}
|
|
308
324
|
class Test extends AsyncResource {
|
|
309
325
|
concurrency: number;
|
|
@@ -1210,6 +1226,10 @@ declare module 'node:test' {
|
|
|
1210
1226
|
* @since v20.4.0
|
|
1211
1227
|
*/
|
|
1212
1228
|
runAll(): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* Calls {@link MockTimers.reset()}.
|
|
1231
|
+
*/
|
|
1232
|
+
[Symbol.dispose](): void;
|
|
1213
1233
|
}
|
|
1214
1234
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };
|
|
1215
1235
|
}
|
|
@@ -68,6 +68,11 @@ declare module 'timers' {
|
|
|
68
68
|
*/
|
|
69
69
|
hasRef(): boolean;
|
|
70
70
|
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
71
|
+
/**
|
|
72
|
+
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
|
73
|
+
* @since v20.5.0
|
|
74
|
+
*/
|
|
75
|
+
[Symbol.dispose](): void;
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
78
|
* This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
|
|
@@ -114,6 +119,11 @@ declare module 'timers' {
|
|
|
114
119
|
*/
|
|
115
120
|
refresh(): this;
|
|
116
121
|
[Symbol.toPrimitive](): number;
|
|
122
|
+
/**
|
|
123
|
+
* Cancels the timeout.
|
|
124
|
+
* @since v20.5.0
|
|
125
|
+
*/
|
|
126
|
+
[Symbol.dispose](): void;
|
|
117
127
|
}
|
|
118
128
|
}
|
|
119
129
|
/**
|
|
@@ -163,10 +173,10 @@ declare module 'timers' {
|
|
|
163
173
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
164
174
|
* @return for use with {@link clearInterval}
|
|
165
175
|
*/
|
|
166
|
-
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.
|
|
176
|
+
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
167
177
|
// util.promisify no rest args compability
|
|
168
178
|
// tslint:disable-next-line void-return
|
|
169
|
-
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.
|
|
179
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
170
180
|
namespace setInterval {
|
|
171
181
|
const __promisify__: typeof setIntervalPromise;
|
|
172
182
|
}
|
|
@@ -302,6 +302,11 @@ declare module 'child_process' {
|
|
|
302
302
|
* @since v0.1.90
|
|
303
303
|
*/
|
|
304
304
|
kill(signal?: NodeJS.Signals | number): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Calls {@link ChildProcess.kill} with `'SIGTERM'`.
|
|
307
|
+
* @since v20.5.0
|
|
308
|
+
*/
|
|
309
|
+
[Symbol.dispose](): void;
|
|
305
310
|
/**
|
|
306
311
|
* When an IPC channel has been established between the parent and child (
|
|
307
312
|
* i.e. when using {@link fork}), the `subprocess.send()` method can
|
|
@@ -538,6 +538,11 @@ declare module 'dgram' {
|
|
|
538
538
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
539
539
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
540
540
|
prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
|
541
|
+
/**
|
|
542
|
+
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
|
543
|
+
* @since v20.5.0
|
|
544
|
+
*/
|
|
545
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
541
546
|
}
|
|
542
547
|
}
|
|
543
548
|
declare module 'node:dgram' {
|
|
@@ -338,6 +338,41 @@ declare module 'events' {
|
|
|
338
338
|
* objects.
|
|
339
339
|
*/
|
|
340
340
|
static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
|
|
341
|
+
/**
|
|
342
|
+
* Listens once to the `abort` event on the provided `signal`.
|
|
343
|
+
*
|
|
344
|
+
* Listening to the `abort` event on abort signals is unsafe and may
|
|
345
|
+
* lead to resource leaks since another third party with the signal can
|
|
346
|
+
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
|
|
347
|
+
* this since it would violate the web standard. Additionally, the original
|
|
348
|
+
* API makes it easy to forget to remove listeners.
|
|
349
|
+
*
|
|
350
|
+
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
|
|
351
|
+
* two issues by listening to the event such that `stopImmediatePropagation` does
|
|
352
|
+
* not prevent the listener from running.
|
|
353
|
+
*
|
|
354
|
+
* Returns a disposable so that it may be unsubscribed from more easily.
|
|
355
|
+
*
|
|
356
|
+
* ```js
|
|
357
|
+
* import { addAbortListener } from 'node:events';
|
|
358
|
+
*
|
|
359
|
+
* function example(signal) {
|
|
360
|
+
* let disposable;
|
|
361
|
+
* try {
|
|
362
|
+
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
|
|
363
|
+
* disposable = addAbortListener(signal, (e) => {
|
|
364
|
+
* // Do something when signal is aborted.
|
|
365
|
+
* });
|
|
366
|
+
* } finally {
|
|
367
|
+
* disposable?.[Symbol.dispose]();
|
|
368
|
+
* }
|
|
369
|
+
* }
|
|
370
|
+
* ```
|
|
371
|
+
* @since v20.5.0
|
|
372
|
+
* @experimental
|
|
373
|
+
* @return that removes the `abort` listener.
|
|
374
|
+
*/
|
|
375
|
+
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
|
341
376
|
/**
|
|
342
377
|
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
|
|
343
378
|
*
|
|
@@ -456,6 +456,11 @@ declare module 'fs/promises' {
|
|
|
456
456
|
* @return Fulfills with `undefined` upon success.
|
|
457
457
|
*/
|
|
458
458
|
close(): Promise<void>;
|
|
459
|
+
/**
|
|
460
|
+
* An alias for {@link FileHandle.close()}.
|
|
461
|
+
* @since v20.4.0
|
|
462
|
+
*/
|
|
463
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
459
464
|
}
|
|
460
465
|
const constants: typeof fsConstants;
|
|
461
466
|
/**
|
|
@@ -84,6 +84,28 @@ declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal:
|
|
|
84
84
|
};
|
|
85
85
|
//#endregion borrowed
|
|
86
86
|
|
|
87
|
+
//#region Disposable
|
|
88
|
+
interface SymbolConstructor {
|
|
89
|
+
/**
|
|
90
|
+
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
|
|
91
|
+
*/
|
|
92
|
+
readonly dispose: unique symbol;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
|
|
96
|
+
*/
|
|
97
|
+
readonly asyncDispose: unique symbol;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface Disposable {
|
|
101
|
+
[Symbol.dispose](): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface AsyncDisposable {
|
|
105
|
+
[Symbol.asyncDispose](): PromiseLike<void>;
|
|
106
|
+
}
|
|
107
|
+
//#endregion Disposable
|
|
108
|
+
|
|
87
109
|
//#region ArrayLike.at()
|
|
88
110
|
interface RelativeIndexable<T> {
|
|
89
111
|
/**
|
|
@@ -639,6 +639,11 @@ declare module 'net' {
|
|
|
639
639
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
640
640
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
641
641
|
prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
642
|
+
/**
|
|
643
|
+
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
|
644
|
+
* @since v20.5.0
|
|
645
|
+
*/
|
|
646
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
642
647
|
}
|
|
643
648
|
type IPVersion = 'ipv4' | 'ipv6';
|
|
644
649
|
/**
|