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