/** * Bounded-concurrency helper for fan-out async work. * * @module utils/map-with-limit */ /** * Run `fn` against each item with at most `limit` operations in flight. * * Results are returned in **input order**, regardless of the order in which * individual promises settle. This matches the semantics callers usually * want when migrating from a sequential `for (const x of xs) { result.push(await fn(x)); }` * pattern: ordering is preserved, but throughput is bounded. * * Errors propagate via the returned Promise. Use `mapWithLimitSettled()` * when individual failures should not abort the batch. * * @example * // 8 charters fetched 5-at-a-time over HTTP: * const manifests = await mapWithLimit(dirs, 5, (dir) => fetchCharter(dir)); * * @param items Inputs to map over. * @param limit Maximum concurrent calls (must be ≥ 1). * @param fn Async mapper. * @returns Array of results in the same order as `items`. */ export declare function mapWithLimit(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise): Promise; /** * Variant of {@link mapWithLimit} that captures individual failures rather * than aborting on the first rejection. Returns an array of * `{ status: 'fulfilled', value }` / `{ status: 'rejected', reason }` in * input order — identical shape to `Promise.allSettled`. * * Use this when one bad input (e.g. a corrupt charter.md) should not stop * the whole batch. */ export declare function mapWithLimitSettled(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise): Promise>>; //# sourceMappingURL=map-with-limit.d.ts.map