@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
16 lines (15 loc) • 900 B
TypeScript
import { MultiError } from 'async-parallel';
import { Context } from '../cms';
/**
* async-parallel makes code simpler and allows limiting concurrency
*/
export declare function asyncMap<T1, T2>(context: Context, list: T1[], action: {
(value: T1, index: number, list: T1[]): Promise<T2>;
}, concurrency?: number, errorTreatment?: (value: T1, e: any) => T2 | undefined): Promise<T2[]>;
type AsyncMapFunction<T1, T2> = (value: T1, index: number, list: T1[]) => Promise<T2 | undefined>;
export declare function resumable<T1, T2 = T1>(action: AsyncMapFunction<T1, T2>, errorTreatment?: (input: T1, e: any) => T2 | undefined): AsyncMapFunction<T1, T2 | undefined>;
export declare function asyncEach<T1, T2>(context: Context, list: T1[], action: {
(value: T1): Promise<T2>;
}, concurrency?: number): Promise<void>;
export declare function reduceMultiError(error: MultiError): Error[];
export {};