The entry point for creating a Stream. Wraps an async generator so that yielded values become success results and any thrown error becomes a single error result.
Use Source.from to create a source from an existing AsyncIterable
or generator function. Use Source.withConcurrency and
Source.withBufferSize to configure parallel execution.
Creates a Source from an existing AsyncIterable or async
generator function. Each value emitted becomes a success result; any
thrown error becomes an error result.
Creates a Source that emits a range of numbers from start (inclusive) to end (exclusive).
Each number is emitted as a success result.
Creates a Source from an async generator that yields Result values directly. This is useful when you want to yield both successes and errors from the source without terminating it on the first error.
fromSchedule(cron: string,options?: { signal?: AbortSignal; }): Source<Tick, never>
Creates a Source that yields a Tick on each cron schedule match. Supports 5-field (minute) and 6-field (second) cron expressions, day/month names (MON-FRI, JAN), and aliases (@daily, @hourly).
This is an in-process scheduler — timing is best-effort (typically within ~50ms). If a tick handler runs longer than the interval, the next tick fires after the handler completes (ticks are not queued). State is not persisted across process restarts.
withBufferSize(n: number): Source<T, E>
Sets the maximum number of buffered results before backpressure is applied to the stream. If the buffer is full, the stream will pause until there is space in the buffer for new results.
withConcurrency(n: number): Source<T, E>
Sets the maximum number of concurrent operations for the stream.