@types/async 3.2.20 → 3.2.22
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.
- async/LICENSE +0 -0
- async/README.md +2 -3
- async/index.d.ts +356 -127
- async/package.json +20 -20
async/LICENSE
CHANGED
|
File without changes
|
async/README.md
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
> `npm install --save @types/async`
|
|
3
3
|
|
|
4
4
|
# Summary
|
|
5
|
-
This package contains type definitions for
|
|
5
|
+
This package contains type definitions for async (https://github.com/caolan/async).
|
|
6
6
|
|
|
7
7
|
# Details
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Tue, 17 Oct 2023 22:10:13 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
|
-
* Global values: `async`
|
|
14
13
|
|
|
15
14
|
# Credits
|
|
16
15
|
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Arseniy Maximov](https://github.com/kern0), [Angus Fenying](https://github.com/fenying), [Pascal Martin](https://github.com/pascalmartin), [Etienne Rossignon](https://github.com/erossignon), [Lifeng Zhu](https://github.com/Juliiii), [Tümay Çeber](https://github.com/brendtumi), and [Andrew Pensinger](https://github.com/apnsngr).
|
async/index.d.ts
CHANGED
|
@@ -1,44 +1,71 @@
|
|
|
1
|
-
// Type definitions for Async 3.2
|
|
2
|
-
// Project: https://github.com/caolan/async, https://caolan.github.io/async
|
|
3
|
-
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
|
4
|
-
// Arseniy Maximov <https://github.com/kern0>
|
|
5
|
-
// Angus Fenying <https://github.com/fenying>
|
|
6
|
-
// Pascal Martin <https://github.com/pascalmartin>
|
|
7
|
-
// Etienne Rossignon <https://github.com/erossignon>
|
|
8
|
-
// Lifeng Zhu <https://github.com/Juliiii>
|
|
9
|
-
// Tümay Çeber <https://github.com/brendtumi>
|
|
10
|
-
// Andrew Pensinger <https://github.com/apnsngr>
|
|
11
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
12
|
-
// TypeScript Version: 2.3
|
|
13
|
-
|
|
14
1
|
export as namespace async;
|
|
15
2
|
|
|
16
|
-
export interface Dictionary<T> {
|
|
3
|
+
export interface Dictionary<T> {
|
|
4
|
+
[key: string]: T;
|
|
5
|
+
}
|
|
17
6
|
export type IterableCollection<T> = T[] | IterableIterator<T> | AsyncIterable<T> | Dictionary<T>;
|
|
18
7
|
|
|
19
|
-
export interface ErrorCallback<E = Error> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export interface
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export interface
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
8
|
+
export interface ErrorCallback<E = Error> {
|
|
9
|
+
(err?: E | null): void;
|
|
10
|
+
}
|
|
11
|
+
export interface AsyncBooleanResultCallback<E = Error> {
|
|
12
|
+
(err?: E | null, truthValue?: boolean): void;
|
|
13
|
+
}
|
|
14
|
+
export interface AsyncResultCallback<T, E = Error> {
|
|
15
|
+
(err?: E | null, result?: T): void;
|
|
16
|
+
}
|
|
17
|
+
export interface AsyncResultArrayCallback<T, E = Error> {
|
|
18
|
+
(err?: E | null, results?: Array<T | undefined>): void;
|
|
19
|
+
}
|
|
20
|
+
export interface AsyncResultObjectCallback<T, E = Error> {
|
|
21
|
+
(err: E | undefined, results: Dictionary<T | undefined>): void;
|
|
22
|
+
}
|
|
23
|
+
export interface AsyncResultRestCallback<T, E = Error> {
|
|
24
|
+
(err?: E | null, ...results: T[]): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AsyncFunction<T, E = Error> {
|
|
28
|
+
(callback: (err?: E | null, result?: T) => void): void;
|
|
29
|
+
}
|
|
30
|
+
export interface AsyncFunctionEx<T, E = Error> {
|
|
31
|
+
(callback: (err?: E | null, ...results: T[]) => void): void;
|
|
32
|
+
}
|
|
33
|
+
export interface AsyncIterator<T, E = Error> {
|
|
34
|
+
(item: T, callback: ErrorCallback<E>): void;
|
|
35
|
+
}
|
|
36
|
+
export interface AsyncForEachOfIterator<T, E = Error> {
|
|
37
|
+
(item: T, key: number | string, callback: ErrorCallback<E>): void;
|
|
38
|
+
}
|
|
39
|
+
export interface AsyncResultIterator<T, R, E = Error> {
|
|
40
|
+
(item: T, callback: AsyncResultCallback<R, E>): void;
|
|
41
|
+
}
|
|
42
|
+
export interface AsyncResultIteratorPromise<T, R> {
|
|
43
|
+
(item: T): Promise<R>;
|
|
44
|
+
}
|
|
45
|
+
export interface AsyncMemoIterator<T, R, E = Error> {
|
|
46
|
+
(memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void;
|
|
47
|
+
}
|
|
48
|
+
export interface AsyncBooleanIterator<T, E = Error> {
|
|
49
|
+
(item: T, callback: AsyncBooleanResultCallback<E>): void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AsyncWorker<T, E = Error> {
|
|
53
|
+
(task: T, callback: ErrorCallback<E>): void;
|
|
54
|
+
}
|
|
55
|
+
export interface AsyncVoidFunction<E = Error> {
|
|
56
|
+
(callback: ErrorCallback<E>): void;
|
|
57
|
+
}
|
|
37
58
|
|
|
38
59
|
export type AsyncAutoTasks<R extends Dictionary<any>, E> = { [K in keyof R]: AsyncAutoTask<R[K], R, E> };
|
|
39
|
-
export type AsyncAutoTask<R1, R extends Dictionary<any>, E> =
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
export type AsyncAutoTask<R1, R extends Dictionary<any>, E> =
|
|
61
|
+
| AsyncAutoTaskFunctionWithoutDependencies<R1, E>
|
|
62
|
+
| Array<keyof R | AsyncAutoTaskFunction<R1, R, E>>;
|
|
63
|
+
export interface AsyncAutoTaskFunctionWithoutDependencies<R1, E = Error> {
|
|
64
|
+
(cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
|
|
65
|
+
}
|
|
66
|
+
export interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E = Error> {
|
|
67
|
+
(results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
|
|
68
|
+
}
|
|
42
69
|
|
|
43
70
|
export interface DataContainer<T> {
|
|
44
71
|
data: T;
|
|
@@ -211,7 +238,7 @@ export interface QueueObject<T> {
|
|
|
211
238
|
* - The `unshift` method was removed.
|
|
212
239
|
*/
|
|
213
240
|
// FIXME: can not use Omit due to ts version restriction. Replace Pick with Omit, when ts 3.5+ will be allowed
|
|
214
|
-
export interface AsyncPriorityQueue<T> extends Pick<QueueObject<T>, Exclude<keyof QueueObject<T>,
|
|
241
|
+
export interface AsyncPriorityQueue<T> extends Pick<QueueObject<T>, Exclude<keyof QueueObject<T>, "push" | "unshift">> {
|
|
215
242
|
push<R>(task: T | T[], priority?: number): Promise<R>;
|
|
216
243
|
push<R, E = Error>(task: T | T[], priority: number, callback: AsyncResultCallback<R, E>): void;
|
|
217
244
|
}
|
|
@@ -229,178 +256,343 @@ export type AsyncQueue<T> = QueueObject<T>;
|
|
|
229
256
|
export type AsyncCargoQueue<T = any> = QueueObject<T>;
|
|
230
257
|
|
|
231
258
|
// Collections
|
|
232
|
-
export function each<T, E = Error>(
|
|
259
|
+
export function each<T, E = Error>(
|
|
260
|
+
arr: IterableCollection<T>,
|
|
261
|
+
iterator: AsyncIterator<T, E>,
|
|
262
|
+
callback: ErrorCallback<E>,
|
|
263
|
+
): void;
|
|
233
264
|
export function each<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncIterator<T, E>): Promise<void>;
|
|
234
265
|
export const eachSeries: typeof each;
|
|
235
|
-
export function eachLimit<T, E = Error>(
|
|
236
|
-
|
|
266
|
+
export function eachLimit<T, E = Error>(
|
|
267
|
+
arr: IterableCollection<T>,
|
|
268
|
+
limit: number,
|
|
269
|
+
iterator: AsyncIterator<T, E>,
|
|
270
|
+
callback: ErrorCallback<E>,
|
|
271
|
+
): void;
|
|
272
|
+
export function eachLimit<T, E = Error>(
|
|
273
|
+
arr: IterableCollection<T>,
|
|
274
|
+
limit: number,
|
|
275
|
+
iterator: AsyncIterator<T, E>,
|
|
276
|
+
): Promise<void>;
|
|
237
277
|
export const forEach: typeof each;
|
|
238
278
|
export const forEachSeries: typeof each;
|
|
239
279
|
export const forEachLimit: typeof eachLimit;
|
|
240
|
-
export function forEachOf<T, E = Error>(
|
|
241
|
-
|
|
280
|
+
export function forEachOf<T, E = Error>(
|
|
281
|
+
obj: IterableCollection<T>,
|
|
282
|
+
iterator: AsyncForEachOfIterator<T, E>,
|
|
283
|
+
callback: ErrorCallback<E>,
|
|
284
|
+
): void;
|
|
285
|
+
export function forEachOf<T, E = Error>(
|
|
286
|
+
obj: IterableCollection<T>,
|
|
287
|
+
iterator: AsyncForEachOfIterator<T, E>,
|
|
288
|
+
): Promise<void>;
|
|
242
289
|
export const forEachOfSeries: typeof forEachOf;
|
|
243
|
-
export function forEachOfLimit<T, E = Error>(
|
|
244
|
-
|
|
290
|
+
export function forEachOfLimit<T, E = Error>(
|
|
291
|
+
obj: IterableCollection<T>,
|
|
292
|
+
limit: number,
|
|
293
|
+
iterator: AsyncForEachOfIterator<T, E>,
|
|
294
|
+
callback: ErrorCallback<E>,
|
|
295
|
+
): void;
|
|
296
|
+
export function forEachOfLimit<T, E = Error>(
|
|
297
|
+
obj: IterableCollection<T>,
|
|
298
|
+
limit: number,
|
|
299
|
+
iterator: AsyncForEachOfIterator<T, E>,
|
|
300
|
+
): Promise<void>;
|
|
245
301
|
export const eachOf: typeof forEachOf;
|
|
246
302
|
export const eachOfSeries: typeof forEachOf;
|
|
247
303
|
export const eachOfLimit: typeof forEachOfLimit;
|
|
248
304
|
export function map<T, R, E = Error>(
|
|
249
305
|
arr: IterableCollection<T>,
|
|
250
|
-
iterator:
|
|
251
|
-
callback: AsyncResultArrayCallback<R, E
|
|
252
|
-
|
|
306
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
307
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
308
|
+
): void;
|
|
253
309
|
export function map<T, R, E = Error>(
|
|
254
310
|
arr: IterableCollection<T>,
|
|
255
|
-
iterator:
|
|
256
|
-
|
|
311
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
312
|
+
): Promise<R[]>;
|
|
257
313
|
|
|
258
314
|
export const mapSeries: typeof map;
|
|
259
315
|
export function mapLimit<T, R, E = Error>(
|
|
260
316
|
arr: IterableCollection<T>,
|
|
261
|
-
limit: number,
|
|
262
|
-
|
|
263
|
-
|
|
317
|
+
limit: number,
|
|
318
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
319
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
320
|
+
): void;
|
|
264
321
|
export function mapLimit<T, R, E = Error>(
|
|
265
322
|
arr: IterableCollection<T>,
|
|
266
|
-
limit: number,
|
|
267
|
-
|
|
323
|
+
limit: number,
|
|
324
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
325
|
+
): Promise<R[]>;
|
|
268
326
|
|
|
269
327
|
export function mapValuesLimit<T, R, E = Error>(
|
|
270
328
|
obj: Dictionary<T>,
|
|
271
329
|
limit: number,
|
|
272
330
|
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
|
273
|
-
callback: AsyncResultObjectCallback<R, E
|
|
274
|
-
|
|
331
|
+
callback: AsyncResultObjectCallback<R, E>,
|
|
332
|
+
): void;
|
|
275
333
|
export function mapValuesLimit<T, R, E = Error>(
|
|
276
334
|
obj: Dictionary<T>,
|
|
277
335
|
limit: number,
|
|
278
|
-
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void
|
|
336
|
+
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
|
279
337
|
): Promise<R>;
|
|
280
338
|
|
|
281
|
-
export function mapValues<T, R, E = Error>(
|
|
339
|
+
export function mapValues<T, R, E = Error>(
|
|
340
|
+
obj: Dictionary<T>,
|
|
341
|
+
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
|
342
|
+
callback: AsyncResultObjectCallback<R, E>,
|
|
343
|
+
): void;
|
|
282
344
|
export function mapValues<T, R, E = Error, C = unknown>(
|
|
283
345
|
obj: Dictionary<T>,
|
|
284
|
-
|
|
285
|
-
|
|
346
|
+
iteratee: (
|
|
347
|
+
value: T,
|
|
348
|
+
key: string,
|
|
349
|
+
callback: C extends undefined ? never : AsyncResultCallback<R, E>,
|
|
350
|
+
// tslint:disable-next-line:void-return
|
|
351
|
+
) => C extends undefined ? Promise<R> : void,
|
|
286
352
|
): Promise<Dictionary<R>>;
|
|
287
353
|
export const mapValuesSeries: typeof mapValues;
|
|
288
|
-
export function filter<T, E = Error>(
|
|
354
|
+
export function filter<T, E = Error>(
|
|
355
|
+
arr: IterableCollection<T>,
|
|
356
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
357
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
358
|
+
): void;
|
|
289
359
|
export function filter<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<T[]>;
|
|
290
360
|
export const filterSeries: typeof filter;
|
|
291
|
-
export function filterLimit<T, E = Error>(
|
|
292
|
-
|
|
361
|
+
export function filterLimit<T, E = Error>(
|
|
362
|
+
arr: IterableCollection<T>,
|
|
363
|
+
limit: number,
|
|
364
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
365
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
366
|
+
): void;
|
|
367
|
+
export function filterLimit<T, E = Error>(
|
|
368
|
+
arr: IterableCollection<T>,
|
|
369
|
+
limit: number,
|
|
370
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
371
|
+
): Promise<T[]>;
|
|
293
372
|
export const select: typeof filter;
|
|
294
373
|
export const selectSeries: typeof filter;
|
|
295
374
|
export const selectLimit: typeof filterLimit;
|
|
296
375
|
export const reject: typeof filter;
|
|
297
376
|
export const rejectSeries: typeof filter;
|
|
298
377
|
export const rejectLimit: typeof filterLimit;
|
|
299
|
-
export function reduce<T, R, E = Error>(
|
|
300
|
-
|
|
378
|
+
export function reduce<T, R, E = Error>(
|
|
379
|
+
arr: T[] | IterableIterator<T>,
|
|
380
|
+
memo: R,
|
|
381
|
+
iterator: AsyncMemoIterator<T, R, E>,
|
|
382
|
+
callback: AsyncResultCallback<R, E>,
|
|
383
|
+
): void;
|
|
384
|
+
export function reduce<T, R, E = Error>(
|
|
385
|
+
arr: T[] | IterableIterator<T>,
|
|
386
|
+
memo: R,
|
|
387
|
+
iterator: AsyncMemoIterator<T, R, E>,
|
|
388
|
+
): Promise<R>;
|
|
301
389
|
export const inject: typeof reduce;
|
|
302
390
|
export const foldl: typeof reduce;
|
|
303
391
|
export const reduceRight: typeof reduce;
|
|
304
392
|
export const foldr: typeof reduce;
|
|
305
|
-
export function detect<T, E = Error>(
|
|
393
|
+
export function detect<T, E = Error>(
|
|
394
|
+
arr: IterableCollection<T>,
|
|
395
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
396
|
+
callback: AsyncResultCallback<T, E>,
|
|
397
|
+
): void;
|
|
306
398
|
export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<T>;
|
|
307
399
|
export const detectSeries: typeof detect;
|
|
308
|
-
export function detectLimit<T, E = Error>(
|
|
309
|
-
|
|
400
|
+
export function detectLimit<T, E = Error>(
|
|
401
|
+
arr: IterableCollection<T>,
|
|
402
|
+
limit: number,
|
|
403
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
404
|
+
callback: AsyncResultCallback<T, E>,
|
|
405
|
+
): void;
|
|
406
|
+
export function detectLimit<T, E = Error>(
|
|
407
|
+
arr: IterableCollection<T>,
|
|
408
|
+
limit: number,
|
|
409
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
410
|
+
): Promise<T>;
|
|
310
411
|
export const find: typeof detect;
|
|
311
412
|
export const findSeries: typeof detect;
|
|
312
413
|
export const findLimit: typeof detectLimit;
|
|
313
|
-
export function sortBy<T, V, E = Error>(
|
|
314
|
-
|
|
315
|
-
|
|
414
|
+
export function sortBy<T, V, E = Error>(
|
|
415
|
+
arr: T[] | IterableIterator<T>,
|
|
416
|
+
iterator: AsyncResultIterator<T, V, E>,
|
|
417
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
418
|
+
): void;
|
|
419
|
+
export function sortBy<T, V, E = Error>(
|
|
420
|
+
arr: T[] | IterableIterator<T>,
|
|
421
|
+
iterator: AsyncResultIterator<T, V, E>,
|
|
422
|
+
): Promise<T[]>;
|
|
423
|
+
export function some<T, E = Error>(
|
|
424
|
+
arr: IterableCollection<T>,
|
|
425
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
426
|
+
callback: AsyncBooleanResultCallback<E>,
|
|
427
|
+
): void;
|
|
316
428
|
export function some<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
|
|
317
429
|
export const someSeries: typeof some;
|
|
318
|
-
export function someLimit<T, E = Error>(
|
|
430
|
+
export function someLimit<T, E = Error>(
|
|
431
|
+
arr: IterableCollection<T>,
|
|
432
|
+
limit: number,
|
|
433
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
434
|
+
callback?: AsyncBooleanResultCallback<E>,
|
|
435
|
+
): void;
|
|
319
436
|
export const any: typeof some;
|
|
320
437
|
export const anySeries: typeof someSeries;
|
|
321
438
|
export const anyLimit: typeof someLimit;
|
|
322
|
-
export function every<T, E = Error>(
|
|
439
|
+
export function every<T, E = Error>(
|
|
440
|
+
arr: IterableCollection<T>,
|
|
441
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
442
|
+
callback: AsyncBooleanResultCallback<E>,
|
|
443
|
+
): void;
|
|
323
444
|
export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
|
|
324
445
|
export const everySeries: typeof every;
|
|
325
|
-
export function everyLimit<T, E = Error>(
|
|
326
|
-
|
|
446
|
+
export function everyLimit<T, E = Error>(
|
|
447
|
+
arr: IterableCollection<T>,
|
|
448
|
+
limit: number,
|
|
449
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
450
|
+
callback: AsyncBooleanResultCallback<E>,
|
|
451
|
+
): void;
|
|
452
|
+
export function everyLimit<T, E = Error>(
|
|
453
|
+
arr: IterableCollection<T>,
|
|
454
|
+
limit: number,
|
|
455
|
+
iterator: AsyncBooleanIterator<T, E>,
|
|
456
|
+
): Promise<boolean>;
|
|
327
457
|
export const all: typeof every;
|
|
328
458
|
export const allSeries: typeof every;
|
|
329
459
|
export const allLimit: typeof everyLimit;
|
|
330
460
|
|
|
331
|
-
export function concat<T, R, E = Error>(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
461
|
+
export function concat<T, R, E = Error>(
|
|
462
|
+
arr: IterableCollection<T>,
|
|
463
|
+
iterator: AsyncResultIterator<T, R[], E>,
|
|
464
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
465
|
+
): void;
|
|
466
|
+
export function concat<T, R, E = Error>(
|
|
467
|
+
arr: IterableCollection<T>,
|
|
468
|
+
iterator: AsyncResultIterator<T, R[], E>,
|
|
469
|
+
): Promise<R[]>;
|
|
470
|
+
export function concatLimit<T, R, E = Error>(
|
|
471
|
+
arr: IterableCollection<T>,
|
|
472
|
+
limit: number,
|
|
473
|
+
iterator: AsyncResultIterator<T, R[], E>,
|
|
474
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
475
|
+
): void;
|
|
476
|
+
export function concatLimit<T, R, E = Error>(
|
|
477
|
+
arr: IterableCollection<T>,
|
|
478
|
+
limit: number,
|
|
479
|
+
iterator: AsyncResultIterator<T, R[], E>,
|
|
480
|
+
): Promise<R[]>;
|
|
335
481
|
export const concatSeries: typeof concat;
|
|
336
482
|
export const flatMap: typeof concat;
|
|
337
483
|
export const flatMapLimit: typeof concatLimit;
|
|
338
484
|
export const flatMapSeries: typeof concatSeries;
|
|
339
485
|
|
|
340
|
-
export function groupBy<T, K, E = Error>(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
486
|
+
export function groupBy<T, K, E = Error>(
|
|
487
|
+
iterable: IterableCollection<T>,
|
|
488
|
+
iterator: AsyncResultIterator<T, K, E>,
|
|
489
|
+
callback: AsyncResultCallback<Record<string, T[]>, E>,
|
|
490
|
+
): void;
|
|
491
|
+
export function groupBy<T, K, E = Error>(
|
|
492
|
+
iterable: IterableCollection<T>,
|
|
493
|
+
iterator: AsyncResultIterator<T, K, E>,
|
|
494
|
+
): Promise<Record<string, T[]>>;
|
|
495
|
+
export function groupByLimit<T, K, E = Error>(
|
|
496
|
+
iterable: IterableCollection<T>,
|
|
497
|
+
limit: number,
|
|
498
|
+
iterator: AsyncResultIterator<T, K, E>,
|
|
499
|
+
callback: AsyncResultCallback<Record<string, T[]>, E>,
|
|
500
|
+
): void;
|
|
501
|
+
export function groupByLimit<T, K, E = Error>(
|
|
502
|
+
iterable: IterableCollection<T>,
|
|
503
|
+
limit: number,
|
|
504
|
+
iterator: AsyncResultIterator<T, K, E>,
|
|
505
|
+
): Promise<Record<string, T[]>>;
|
|
344
506
|
export const groupBySeries: typeof groupBy;
|
|
345
507
|
|
|
346
508
|
// Control Flow
|
|
347
509
|
export function series<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultArrayCallback<T, E>): void;
|
|
348
|
-
export function series<T, E = Error>(
|
|
510
|
+
export function series<T, E = Error>(
|
|
511
|
+
tasks: Dictionary<AsyncFunction<T, E>>,
|
|
512
|
+
callback: AsyncResultObjectCallback<T, E>,
|
|
513
|
+
): void;
|
|
349
514
|
export function series<T, E = Error>(tasks: Array<AsyncFunction<T, E>>): Promise<T[]>;
|
|
350
515
|
export function series<T, E = Error>(tasks: Dictionary<AsyncFunction<T, E>>): Promise<Dictionary<T>>;
|
|
351
|
-
export function parallel<T, E = Error>(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
export function
|
|
356
|
-
|
|
516
|
+
export function parallel<T, E = Error>(
|
|
517
|
+
tasks: Array<AsyncFunction<T, E>>,
|
|
518
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
519
|
+
): void;
|
|
520
|
+
export function parallel<T, E = Error>(
|
|
521
|
+
tasks: Dictionary<AsyncFunction<T, E>>,
|
|
522
|
+
callback: AsyncResultObjectCallback<T, E>,
|
|
523
|
+
): void;
|
|
524
|
+
export function parallel<T, R, E = Error>(
|
|
525
|
+
tasks: Array<AsyncFunction<T, E>> | Dictionary<AsyncFunction<T, E>>,
|
|
526
|
+
): Promise<R>;
|
|
527
|
+
export function parallelLimit<T, E = Error>(
|
|
528
|
+
tasks: Array<AsyncFunction<T, E>>,
|
|
529
|
+
limit: number,
|
|
530
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
531
|
+
): void;
|
|
532
|
+
export function parallelLimit<T, E = Error>(
|
|
533
|
+
tasks: Dictionary<AsyncFunction<T, E>>,
|
|
534
|
+
limit: number,
|
|
535
|
+
callback: AsyncResultObjectCallback<T, E>,
|
|
536
|
+
): void;
|
|
537
|
+
export function parallelLimit<T, R, E = Error>(
|
|
538
|
+
tasks: Array<AsyncFunction<T, E>> | Dictionary<AsyncFunction<T, E>>,
|
|
539
|
+
limit: number,
|
|
540
|
+
): Promise<R>;
|
|
357
541
|
|
|
358
542
|
export function whilst<T, E = Error>(
|
|
359
543
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
360
544
|
fn: AsyncFunctionEx<T, E>,
|
|
361
|
-
callback: AsyncResultRestCallback<T, E
|
|
545
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
362
546
|
): void;
|
|
363
547
|
export function whilst<T, R, E = Error>(
|
|
364
548
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
365
|
-
fn: AsyncFunctionEx<T, E
|
|
549
|
+
fn: AsyncFunctionEx<T, E>,
|
|
366
550
|
): Promise<R>;
|
|
367
551
|
export function doWhilst<T, E = Error>(
|
|
368
552
|
fn: AsyncFunctionEx<T, E>,
|
|
369
553
|
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
370
|
-
callback: AsyncResultRestCallback<T, E
|
|
554
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
371
555
|
): void;
|
|
372
556
|
export function doWhilst<T, R, E = Error>(
|
|
373
557
|
fn: AsyncFunctionEx<T, E>,
|
|
374
|
-
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void
|
|
558
|
+
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
375
559
|
): Promise<R>;
|
|
376
560
|
export function until<T, E = Error>(
|
|
377
561
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
378
562
|
fn: AsyncFunctionEx<T, E>,
|
|
379
|
-
callback: AsyncResultRestCallback<T, E
|
|
563
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
380
564
|
): void;
|
|
381
565
|
export function until<T, R, E = Error>(
|
|
382
566
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
383
|
-
fn: AsyncFunctionEx<T, E
|
|
567
|
+
fn: AsyncFunctionEx<T, E>,
|
|
384
568
|
): Promise<R>;
|
|
385
569
|
export function doUntil<T, E = Error>(
|
|
386
570
|
fn: AsyncFunctionEx<T, E>,
|
|
387
571
|
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
388
|
-
callback: AsyncResultRestCallback<T, E
|
|
572
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
389
573
|
): void;
|
|
390
574
|
export function doUntil<T, R, E = Error>(
|
|
391
575
|
fn: AsyncFunctionEx<T, E>,
|
|
392
|
-
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void
|
|
576
|
+
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
393
577
|
): Promise<R>;
|
|
394
578
|
|
|
395
|
-
export function during<E = Error>(
|
|
396
|
-
|
|
579
|
+
export function during<E = Error>(
|
|
580
|
+
test: (testCallback: AsyncBooleanResultCallback<E>) => void,
|
|
581
|
+
fn: AsyncVoidFunction<E>,
|
|
582
|
+
callback: ErrorCallback<E>,
|
|
583
|
+
): void;
|
|
584
|
+
export function doDuring<E = Error>(
|
|
585
|
+
fn: AsyncVoidFunction<E>,
|
|
586
|
+
test: (testCallback: AsyncBooleanResultCallback<E>) => void,
|
|
587
|
+
callback: ErrorCallback<E>,
|
|
588
|
+
): void;
|
|
397
589
|
export function forever<E = Error>(next: (next: ErrorCallback<E>) => void, errBack: ErrorCallback<E>): void;
|
|
398
590
|
export function waterfall<T>(tasks: Function[]): Promise<T>;
|
|
399
591
|
export function waterfall<T, E = Error>(tasks: Function[], callback: AsyncResultCallback<T, E>): void;
|
|
400
592
|
export function compose(...fns: Function[]): Function;
|
|
401
593
|
export function seq(...fns: Function[]): Function;
|
|
402
|
-
export function applyEach(fns: Function[], ...argsAndCallback: any[]): void;
|
|
403
|
-
export function applyEachSeries(fns: Function[], ...argsAndCallback: any[]): void;
|
|
594
|
+
export function applyEach(fns: Function[], ...argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
|
595
|
+
export function applyEachSeries(fns: Function[], ...argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
|
404
596
|
export function queue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): QueueObject<T>;
|
|
405
597
|
export function queue<T, R, E = Error>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): QueueObject<T>;
|
|
406
598
|
export function priorityQueue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncPriorityQueue<T>;
|
|
@@ -410,9 +602,19 @@ export function cargoQueue<T, E = Error>(
|
|
|
410
602
|
concurrency?: number,
|
|
411
603
|
payload?: number,
|
|
412
604
|
): QueueObject<T>;
|
|
413
|
-
export function auto<R extends Dictionary<any>, E = Error>(
|
|
414
|
-
|
|
415
|
-
|
|
605
|
+
export function auto<R extends Dictionary<any>, E = Error>(
|
|
606
|
+
tasks: AsyncAutoTasks<R, E>,
|
|
607
|
+
concurrency?: number,
|
|
608
|
+
): Promise<R>;
|
|
609
|
+
export function auto<R extends Dictionary<any>, E = Error>(
|
|
610
|
+
tasks: AsyncAutoTasks<R, E>,
|
|
611
|
+
concurrency: number,
|
|
612
|
+
callback: AsyncResultCallback<R, E>,
|
|
613
|
+
): void;
|
|
614
|
+
export function auto<R extends Dictionary<any>, E = Error>(
|
|
615
|
+
tasks: AsyncAutoTasks<R, E>,
|
|
616
|
+
callback: AsyncResultCallback<R, E>,
|
|
617
|
+
): void;
|
|
416
618
|
export function autoInject<E = Error>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
|
|
417
619
|
|
|
418
620
|
export interface RetryOptions<E> {
|
|
@@ -446,53 +648,80 @@ export function apply<E = Error>(fn: Function, ...args: any[]): AsyncFunction<an
|
|
|
446
648
|
export function nextTick(callback: Function, ...args: any[]): void;
|
|
447
649
|
export const setImmediate: typeof nextTick;
|
|
448
650
|
|
|
449
|
-
export function reflect<T, E = Error>(
|
|
450
|
-
|
|
651
|
+
export function reflect<T, E = Error>(
|
|
652
|
+
fn: AsyncFunction<T, E>,
|
|
653
|
+
): (callback: (err: null, result: { error?: E | undefined; value?: T | undefined }) => void) => void;
|
|
654
|
+
export function reflectAll<T, E = Error>(
|
|
655
|
+
tasks: Array<AsyncFunction<T, E>>,
|
|
656
|
+
): Array<(callback: (err: null, result: { error?: E | undefined; value?: T | undefined }) => void) => void>;
|
|
451
657
|
|
|
452
658
|
export function timeout<T, E = Error>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
|
|
453
|
-
export function timeout<T, R, E = Error>(
|
|
659
|
+
export function timeout<T, R, E = Error>(
|
|
660
|
+
fn: AsyncResultIterator<T, R, E>,
|
|
661
|
+
milliseconds: number,
|
|
662
|
+
info?: any,
|
|
663
|
+
): AsyncResultIterator<T, R, E>;
|
|
454
664
|
|
|
455
|
-
export function times<T, E = Error>(
|
|
456
|
-
|
|
665
|
+
export function times<T, E = Error>(
|
|
666
|
+
n: number,
|
|
667
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
668
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
669
|
+
): void;
|
|
670
|
+
export function times<T, E = Error>(
|
|
671
|
+
n: number,
|
|
672
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
673
|
+
): Promise<T>;
|
|
457
674
|
|
|
458
675
|
export const timesSeries: typeof times;
|
|
459
676
|
export function timesLimit<T, E = Error>(
|
|
460
677
|
n: number,
|
|
461
678
|
limit: number,
|
|
462
|
-
iterator:
|
|
463
|
-
callback: AsyncResultArrayCallback<T, E
|
|
464
|
-
|
|
679
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
680
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
681
|
+
): void;
|
|
465
682
|
export function timesLimit<T, E = Error>(
|
|
466
683
|
n: number,
|
|
467
684
|
limit: number,
|
|
468
|
-
iterator:
|
|
469
|
-
|
|
685
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
686
|
+
): Promise<T>;
|
|
470
687
|
|
|
471
|
-
export function transform<T, R, E = Error>(
|
|
472
|
-
|
|
688
|
+
export function transform<T, R, E = Error>(
|
|
689
|
+
arr: T[],
|
|
690
|
+
iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void,
|
|
691
|
+
callback?: AsyncResultArrayCallback<T, E>,
|
|
692
|
+
): void;
|
|
693
|
+
export function transform<T, R, E = Error>(
|
|
694
|
+
arr: T[],
|
|
695
|
+
acc: R[],
|
|
696
|
+
iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void,
|
|
697
|
+
callback?: AsyncResultArrayCallback<T, E>,
|
|
698
|
+
): void;
|
|
473
699
|
|
|
474
700
|
export function transform<T, R, E = Error>(
|
|
475
|
-
arr: {[key: string]: T},
|
|
476
|
-
iteratee: (acc: {[key: string]: R}, item: T, key: string, callback: (error?: E) => void) => void,
|
|
477
|
-
callback?: AsyncResultObjectCallback<T, E
|
|
478
|
-
|
|
701
|
+
arr: { [key: string]: T },
|
|
702
|
+
iteratee: (acc: { [key: string]: R }, item: T, key: string, callback: (error?: E) => void) => void,
|
|
703
|
+
callback?: AsyncResultObjectCallback<T, E>,
|
|
704
|
+
): void;
|
|
479
705
|
|
|
480
706
|
export function transform<T, R, E = Error>(
|
|
481
|
-
arr: {[key: string]: T},
|
|
482
|
-
acc: {[key: string]: R},
|
|
483
|
-
iteratee: (acc: {[key: string]: R}, item: T, key: string, callback: (error?: E) => void) => void,
|
|
484
|
-
callback?: AsyncResultObjectCallback<T, E
|
|
485
|
-
|
|
707
|
+
arr: { [key: string]: T },
|
|
708
|
+
acc: { [key: string]: R },
|
|
709
|
+
iteratee: (acc: { [key: string]: R }, item: T, key: string, callback: (error?: E) => void) => void,
|
|
710
|
+
callback?: AsyncResultObjectCallback<T, E>,
|
|
711
|
+
): void;
|
|
486
712
|
|
|
487
713
|
export function race<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultCallback<T, E>): void;
|
|
488
714
|
|
|
489
|
-
export function tryEach<T, E = Error>(
|
|
715
|
+
export function tryEach<T, E = Error>(
|
|
716
|
+
tasks: IterableCollection<AsyncFunction<T>>,
|
|
717
|
+
callback: AsyncResultCallback<T, E>,
|
|
718
|
+
): void;
|
|
490
719
|
export function tryEach<T>(tasks: IterableCollection<AsyncFunction<T>>): Promise<T>;
|
|
491
720
|
|
|
492
721
|
// Utils
|
|
493
722
|
export function memoize(fn: Function, hasher?: Function): Function;
|
|
494
723
|
export function unmemoize(fn: Function): Function;
|
|
495
|
-
export function ensureAsync(fn: (...
|
|
724
|
+
export function ensureAsync(fn: (...argsAndCallback: any[]) => void): Function;
|
|
496
725
|
export function constant(...values: any[]): AsyncFunction<any>;
|
|
497
726
|
export function asyncify(fn: Function): (...args: any[]) => any;
|
|
498
727
|
export function wrapSync(fn: Function): Function;
|
async/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/async",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "TypeScript definitions for
|
|
3
|
+
"version": "3.2.22",
|
|
4
|
+
"description": "TypeScript definitions for async",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"contributors": [
|
|
8
8
|
{
|
|
9
9
|
"name": "Boris Yankov",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"githubUsername": "borisyankov",
|
|
11
|
+
"url": "https://github.com/borisyankov"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "Arseniy Maximov",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"githubUsername": "kern0",
|
|
16
|
+
"url": "https://github.com/kern0"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "Angus Fenying",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"githubUsername": "fenying",
|
|
21
|
+
"url": "https://github.com/fenying"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"name": "Pascal Martin",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"githubUsername": "pascalmartin",
|
|
26
|
+
"url": "https://github.com/pascalmartin"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"name": "Etienne Rossignon",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"githubUsername": "erossignon",
|
|
31
|
+
"url": "https://github.com/erossignon"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "Lifeng Zhu",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"githubUsername": "Juliiii",
|
|
36
|
+
"url": "https://github.com/Juliiii"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "Tümay Çeber",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"githubUsername": "brendtumi",
|
|
41
|
+
"url": "https://github.com/brendtumi"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "Andrew Pensinger",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"githubUsername": "apnsngr",
|
|
46
|
+
"url": "https://github.com/apnsngr"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
"main": "",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"scripts": {},
|
|
57
57
|
"dependencies": {},
|
|
58
|
-
"typesPublisherContentHash": "
|
|
59
|
-
"typeScriptVersion": "4.
|
|
58
|
+
"typesPublisherContentHash": "8c7783341010dad4cd44b4e3e490f3b051e4bb17b1be7420e1d074ffcfdbf458",
|
|
59
|
+
"typeScriptVersion": "4.5"
|
|
60
60
|
}
|