Introduction
@haskou/flow provides dependency-light classes for coordinating async work in TypeScript services.
Use it when promise-producing work needs rules around when it starts, how often it runs, how long it may take, how failures are retried, or which fallback source should be used.
The main classes are:
Semaphoreto share a fixed concurrency capacity across unrelated code paths.Queueto run submitted tasks with bounded concurrency.RateLimiterandThrottlerto space task starts over time.Timeoutto fail work that takes too long.Retrierto retry transient failures.Racerto run alternative async sources and keep the first successful result.Abortableto cancel running work.Schedulerto run repeated jobs without overlap.Debouncerto collapse bursts into one latest task.CircuitBreakerto protect unstable dependencies.FallbackChainto read from ordered sources such as memory, Redis, database, and remote API.Flowto combine several controls around one task.
Numbers are accepted at public boundaries where they are convenient. Time values can also be passed as Duration from @haskou/value-objects.