@types/async 3.2.20 → 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 +1 -1
- async/index.d.ts +356 -114
- async/package.json +3 -3
async/LICENSE
CHANGED
|
File without changes
|
async/README.md
CHANGED
|
@@ -8,7 +8,7 @@ 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:
|
|
11
|
+
* Last updated: Fri, 22 Sep 2023 18:11:04 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `async`
|
|
14
14
|
|
async/index.d.ts
CHANGED
|
@@ -13,32 +13,72 @@
|
|
|
13
13
|
|
|
14
14
|
export as namespace async;
|
|
15
15
|
|
|
16
|
-
export interface Dictionary<T> {
|
|
16
|
+
export interface Dictionary<T> {
|
|
17
|
+
[key: string]: T;
|
|
18
|
+
}
|
|
17
19
|
export type IterableCollection<T> = T[] | IterableIterator<T> | AsyncIterable<T> | Dictionary<T>;
|
|
18
20
|
|
|
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
|
-
|
|
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
|
+
}
|
|
37
71
|
|
|
38
72
|
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
|
-
|
|
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
|
+
}
|
|
42
82
|
|
|
43
83
|
export interface DataContainer<T> {
|
|
44
84
|
data: T;
|
|
@@ -211,7 +251,7 @@ export interface QueueObject<T> {
|
|
|
211
251
|
* - The `unshift` method was removed.
|
|
212
252
|
*/
|
|
213
253
|
// 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>,
|
|
254
|
+
export interface AsyncPriorityQueue<T> extends Pick<QueueObject<T>, Exclude<keyof QueueObject<T>, "push" | "unshift">> {
|
|
215
255
|
push<R>(task: T | T[], priority?: number): Promise<R>;
|
|
216
256
|
push<R, E = Error>(task: T | T[], priority: number, callback: AsyncResultCallback<R, E>): void;
|
|
217
257
|
}
|
|
@@ -229,178 +269,343 @@ export type AsyncQueue<T> = QueueObject<T>;
|
|
|
229
269
|
export type AsyncCargoQueue<T = any> = QueueObject<T>;
|
|
230
270
|
|
|
231
271
|
// Collections
|
|
232
|
-
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;
|
|
233
277
|
export function each<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncIterator<T, E>): Promise<void>;
|
|
234
278
|
export const eachSeries: typeof each;
|
|
235
|
-
export function eachLimit<T, E = Error>(
|
|
236
|
-
|
|
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>;
|
|
237
290
|
export const forEach: typeof each;
|
|
238
291
|
export const forEachSeries: typeof each;
|
|
239
292
|
export const forEachLimit: typeof eachLimit;
|
|
240
|
-
export function forEachOf<T, E = Error>(
|
|
241
|
-
|
|
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>;
|
|
242
302
|
export const forEachOfSeries: typeof forEachOf;
|
|
243
|
-
export function forEachOfLimit<T, E = Error>(
|
|
244
|
-
|
|
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>;
|
|
245
314
|
export const eachOf: typeof forEachOf;
|
|
246
315
|
export const eachOfSeries: typeof forEachOf;
|
|
247
316
|
export const eachOfLimit: typeof forEachOfLimit;
|
|
248
317
|
export function map<T, R, E = Error>(
|
|
249
318
|
arr: IterableCollection<T>,
|
|
250
|
-
iterator:
|
|
251
|
-
callback: AsyncResultArrayCallback<R, E
|
|
252
|
-
|
|
319
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
320
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
321
|
+
): void;
|
|
253
322
|
export function map<T, R, E = Error>(
|
|
254
323
|
arr: IterableCollection<T>,
|
|
255
|
-
iterator:
|
|
256
|
-
|
|
324
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
325
|
+
): Promise<R[]>;
|
|
257
326
|
|
|
258
327
|
export const mapSeries: typeof map;
|
|
259
328
|
export function mapLimit<T, R, E = Error>(
|
|
260
329
|
arr: IterableCollection<T>,
|
|
261
|
-
limit: number,
|
|
262
|
-
|
|
263
|
-
|
|
330
|
+
limit: number,
|
|
331
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
332
|
+
callback: AsyncResultArrayCallback<R, E>,
|
|
333
|
+
): void;
|
|
264
334
|
export function mapLimit<T, R, E = Error>(
|
|
265
335
|
arr: IterableCollection<T>,
|
|
266
|
-
limit: number,
|
|
267
|
-
|
|
336
|
+
limit: number,
|
|
337
|
+
iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>,
|
|
338
|
+
): Promise<R[]>;
|
|
268
339
|
|
|
269
340
|
export function mapValuesLimit<T, R, E = Error>(
|
|
270
341
|
obj: Dictionary<T>,
|
|
271
342
|
limit: number,
|
|
272
343
|
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
|
273
|
-
callback: AsyncResultObjectCallback<R, E
|
|
274
|
-
|
|
344
|
+
callback: AsyncResultObjectCallback<R, E>,
|
|
345
|
+
): void;
|
|
275
346
|
export function mapValuesLimit<T, R, E = Error>(
|
|
276
347
|
obj: Dictionary<T>,
|
|
277
348
|
limit: number,
|
|
278
|
-
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void
|
|
349
|
+
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
|
279
350
|
): Promise<R>;
|
|
280
351
|
|
|
281
|
-
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;
|
|
282
357
|
export function mapValues<T, R, E = Error, C = unknown>(
|
|
283
358
|
obj: Dictionary<T>,
|
|
284
|
-
|
|
285
|
-
|
|
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,
|
|
286
365
|
): Promise<Dictionary<R>>;
|
|
287
366
|
export const mapValuesSeries: typeof mapValues;
|
|
288
|
-
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;
|
|
289
372
|
export function filter<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<T[]>;
|
|
290
373
|
export const filterSeries: typeof filter;
|
|
291
|
-
export function filterLimit<T, E = Error>(
|
|
292
|
-
|
|
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[]>;
|
|
293
385
|
export const select: typeof filter;
|
|
294
386
|
export const selectSeries: typeof filter;
|
|
295
387
|
export const selectLimit: typeof filterLimit;
|
|
296
388
|
export const reject: typeof filter;
|
|
297
389
|
export const rejectSeries: typeof filter;
|
|
298
390
|
export const rejectLimit: typeof filterLimit;
|
|
299
|
-
export function reduce<T, R, E = Error>(
|
|
300
|
-
|
|
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>;
|
|
301
402
|
export const inject: typeof reduce;
|
|
302
403
|
export const foldl: typeof reduce;
|
|
303
404
|
export const reduceRight: typeof reduce;
|
|
304
405
|
export const foldr: typeof reduce;
|
|
305
|
-
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;
|
|
306
411
|
export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<T>;
|
|
307
412
|
export const detectSeries: typeof detect;
|
|
308
|
-
export function detectLimit<T, E = Error>(
|
|
309
|
-
|
|
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>;
|
|
310
424
|
export const find: typeof detect;
|
|
311
425
|
export const findSeries: typeof detect;
|
|
312
426
|
export const findLimit: typeof detectLimit;
|
|
313
|
-
export function sortBy<T, V, E = Error>(
|
|
314
|
-
|
|
315
|
-
|
|
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;
|
|
316
441
|
export function some<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
|
|
317
442
|
export const someSeries: typeof some;
|
|
318
|
-
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;
|
|
319
449
|
export const any: typeof some;
|
|
320
450
|
export const anySeries: typeof someSeries;
|
|
321
451
|
export const anyLimit: typeof someLimit;
|
|
322
|
-
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;
|
|
323
457
|
export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
|
|
324
458
|
export const everySeries: typeof every;
|
|
325
|
-
export function everyLimit<T, E = Error>(
|
|
326
|
-
|
|
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>;
|
|
327
470
|
export const all: typeof every;
|
|
328
471
|
export const allSeries: typeof every;
|
|
329
472
|
export const allLimit: typeof everyLimit;
|
|
330
473
|
|
|
331
|
-
export function concat<T, R, E = Error>(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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[]>;
|
|
335
494
|
export const concatSeries: typeof concat;
|
|
336
495
|
export const flatMap: typeof concat;
|
|
337
496
|
export const flatMapLimit: typeof concatLimit;
|
|
338
497
|
export const flatMapSeries: typeof concatSeries;
|
|
339
498
|
|
|
340
|
-
export function groupBy<T, K, E = Error>(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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[]>>;
|
|
344
519
|
export const groupBySeries: typeof groupBy;
|
|
345
520
|
|
|
346
521
|
// Control Flow
|
|
347
522
|
export function series<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultArrayCallback<T, E>): void;
|
|
348
|
-
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;
|
|
349
527
|
export function series<T, E = Error>(tasks: Array<AsyncFunction<T, E>>): Promise<T[]>;
|
|
350
528
|
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
|
-
|
|
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>;
|
|
357
554
|
|
|
358
555
|
export function whilst<T, E = Error>(
|
|
359
556
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
360
557
|
fn: AsyncFunctionEx<T, E>,
|
|
361
|
-
callback: AsyncResultRestCallback<T, E
|
|
558
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
362
559
|
): void;
|
|
363
560
|
export function whilst<T, R, E = Error>(
|
|
364
561
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
365
|
-
fn: AsyncFunctionEx<T, E
|
|
562
|
+
fn: AsyncFunctionEx<T, E>,
|
|
366
563
|
): Promise<R>;
|
|
367
564
|
export function doWhilst<T, E = Error>(
|
|
368
565
|
fn: AsyncFunctionEx<T, E>,
|
|
369
566
|
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
370
|
-
callback: AsyncResultRestCallback<T, E
|
|
567
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
371
568
|
): void;
|
|
372
569
|
export function doWhilst<T, R, E = Error>(
|
|
373
570
|
fn: AsyncFunctionEx<T, E>,
|
|
374
|
-
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void
|
|
571
|
+
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
375
572
|
): Promise<R>;
|
|
376
573
|
export function until<T, E = Error>(
|
|
377
574
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
378
575
|
fn: AsyncFunctionEx<T, E>,
|
|
379
|
-
callback: AsyncResultRestCallback<T, E
|
|
576
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
380
577
|
): void;
|
|
381
578
|
export function until<T, R, E = Error>(
|
|
382
579
|
test: (cb: AsyncBooleanResultCallback) => void,
|
|
383
|
-
fn: AsyncFunctionEx<T, E
|
|
580
|
+
fn: AsyncFunctionEx<T, E>,
|
|
384
581
|
): Promise<R>;
|
|
385
582
|
export function doUntil<T, E = Error>(
|
|
386
583
|
fn: AsyncFunctionEx<T, E>,
|
|
387
584
|
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
388
|
-
callback: AsyncResultRestCallback<T, E
|
|
585
|
+
callback: AsyncResultRestCallback<T, E>,
|
|
389
586
|
): void;
|
|
390
587
|
export function doUntil<T, R, E = Error>(
|
|
391
588
|
fn: AsyncFunctionEx<T, E>,
|
|
392
|
-
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void
|
|
589
|
+
test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
|
|
393
590
|
): Promise<R>;
|
|
394
591
|
|
|
395
|
-
export function during<E = Error>(
|
|
396
|
-
|
|
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;
|
|
397
602
|
export function forever<E = Error>(next: (next: ErrorCallback<E>) => void, errBack: ErrorCallback<E>): void;
|
|
398
603
|
export function waterfall<T>(tasks: Function[]): Promise<T>;
|
|
399
604
|
export function waterfall<T, E = Error>(tasks: Function[], callback: AsyncResultCallback<T, E>): void;
|
|
400
605
|
export function compose(...fns: Function[]): Function;
|
|
401
606
|
export function seq(...fns: Function[]): Function;
|
|
402
|
-
export function applyEach(fns: Function[], ...argsAndCallback: any[]): void;
|
|
403
|
-
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.
|
|
404
609
|
export function queue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): QueueObject<T>;
|
|
405
610
|
export function queue<T, R, E = Error>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): QueueObject<T>;
|
|
406
611
|
export function priorityQueue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncPriorityQueue<T>;
|
|
@@ -410,9 +615,19 @@ export function cargoQueue<T, E = Error>(
|
|
|
410
615
|
concurrency?: number,
|
|
411
616
|
payload?: number,
|
|
412
617
|
): QueueObject<T>;
|
|
413
|
-
export function auto<R extends Dictionary<any>, E = Error>(
|
|
414
|
-
|
|
415
|
-
|
|
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;
|
|
416
631
|
export function autoInject<E = Error>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
|
|
417
632
|
|
|
418
633
|
export interface RetryOptions<E> {
|
|
@@ -446,53 +661,80 @@ export function apply<E = Error>(fn: Function, ...args: any[]): AsyncFunction<an
|
|
|
446
661
|
export function nextTick(callback: Function, ...args: any[]): void;
|
|
447
662
|
export const setImmediate: typeof nextTick;
|
|
448
663
|
|
|
449
|
-
export function reflect<T, E = Error>(
|
|
450
|
-
|
|
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>;
|
|
451
670
|
|
|
452
671
|
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>(
|
|
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>;
|
|
454
677
|
|
|
455
|
-
export function times<T, E = Error>(
|
|
456
|
-
|
|
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>;
|
|
457
687
|
|
|
458
688
|
export const timesSeries: typeof times;
|
|
459
689
|
export function timesLimit<T, E = Error>(
|
|
460
690
|
n: number,
|
|
461
691
|
limit: number,
|
|
462
|
-
iterator:
|
|
463
|
-
callback: AsyncResultArrayCallback<T, E
|
|
464
|
-
|
|
692
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
693
|
+
callback: AsyncResultArrayCallback<T, E>,
|
|
694
|
+
): void;
|
|
465
695
|
export function timesLimit<T, E = Error>(
|
|
466
696
|
n: number,
|
|
467
697
|
limit: number,
|
|
468
|
-
iterator:
|
|
469
|
-
|
|
698
|
+
iterator: AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>,
|
|
699
|
+
): Promise<T>;
|
|
470
700
|
|
|
471
|
-
export function transform<T, R, E = Error>(
|
|
472
|
-
|
|
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;
|
|
473
712
|
|
|
474
713
|
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
|
-
|
|
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;
|
|
479
718
|
|
|
480
719
|
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
|
-
|
|
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;
|
|
486
725
|
|
|
487
726
|
export function race<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultCallback<T, E>): void;
|
|
488
727
|
|
|
489
|
-
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;
|
|
490
732
|
export function tryEach<T>(tasks: IterableCollection<AsyncFunction<T>>): Promise<T>;
|
|
491
733
|
|
|
492
734
|
// Utils
|
|
493
735
|
export function memoize(fn: Function, hasher?: Function): Function;
|
|
494
736
|
export function unmemoize(fn: Function): Function;
|
|
495
|
-
export function ensureAsync(fn: (...
|
|
737
|
+
export function ensureAsync(fn: (...argsAndCallback: any[]) => void): Function;
|
|
496
738
|
export function constant(...values: any[]): AsyncFunction<any>;
|
|
497
739
|
export function asyncify(fn: Function): (...args: any[]) => any;
|
|
498
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",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"scripts": {},
|
|
57
57
|
"dependencies": {},
|
|
58
|
-
"typesPublisherContentHash": "
|
|
59
|
-
"typeScriptVersion": "4.
|
|
58
|
+
"typesPublisherContentHash": "1fcaace91e1eb18e5067df2372847ac266bc288bee9edf10e887ddf6d3b294d0",
|
|
59
|
+
"typeScriptVersion": "4.5"
|
|
60
60
|
}
|