caminho
Version:
Tool for creating efficient data pipelines in a JavaScript environment
36 lines • 1.6 kB
TypeScript
import type { Loggers, ValueBag } from '../types';
import { type OperatorApplier } from './helpers/operatorHelpers';
export type BatchParams = {
/**
* The name of the property to be assigned to the cumulate context.
* The value of the property is the returned value from the step.
* Keep in mind that the order of the returned values must be the same order you received the values
* so it gets properly assigned to the context
*/
provides?: string;
/**
* Name of the step, useful when logging the steps
*/
name?: string;
/**
* Concurrency is unlimited by default, it means a step can be run concurrently as many times as the flow produces
* You can limit the concurrency by using the `maxConcurrency` property.
* This is useful for example when you are calling an API that can't handle too many concurrent requests.
*/
maxConcurrency?: number;
fn: (valueBag: ValueBag[]) => unknown[] | Promise<unknown[]>;
batch: {
/**
* Defines the maximum number of items that a batch can contain.
*/
maxSize: number;
/**
* Time before a batch is dispatched if the maxSize is not achieved before.
*/
timeoutMs: number;
};
};
export declare function batch(params: BatchParams, loggers: Loggers): OperatorApplier;
export declare function valueBagGetterBatchNoProvides(): (valueBag: ValueBag[]) => ValueBag[];
export declare function valueBagGetterBatchProvides(provides: string): (valueBags: ValueBag[], values: unknown[]) => ValueBag[];
//# sourceMappingURL=batch.d.ts.map