API reference › @evolu/common › Schedule
Composable scheduling strategies.
Composition
| Name | Description |
|---|---|
| ScheduleStep | Base interface for schedule-based task helpers. |
| intersectSchedules | Combines two schedules with AND semantics. |
| sequenceSchedules | Sequences schedules: runs each until it stops, then continues with the next. |
| unionSchedules | Combines two schedules with OR semantics. |
| whenInput | Selects between two schedules based on input. |
Constructors
| Name | Description |
|---|---|
| elapsed | A schedule that outputs the total elapsed time since the schedule started. |
| forever | A schedule that never stops and has no delay. |
| once | A schedule that runs exactly once with no delay. |
| always | A schedule that always outputs a constant value. |
| during | A schedule that runs for a specified duration then stops. |
| exponential | Exponential backoff schedule. |
| fibonacci | Fibonacci backoff schedule. |
| fixed | Fixed interval schedule aligned to time windows. |
| fromDelay | A schedule that runs once with a single delay. |
| fromDelays | A schedule that runs through a sequence of delays. |
| linear | Linear backoff schedule. |
| passthrough | Creates a schedule that outputs its input, or wraps an existing schedule to output input instead of the original output. |
| recurs | A schedule that recurs a fixed number of times. |
| spaced | Constant delay schedule. |
| unfoldSchedule | Creates a schedule by unfolding a state. |
| windowed | Divides the timeline into fixed windows and sleeps until the next boundary. |
Limiting
| Function | Description |
|---|---|
| maxDelay | Caps the delay to a maximum value. |
| maxElapsed | Limits schedule execution to a maximum elapsed time. |
| take | Limits a schedule to a maximum number of attempts. |
Delay
| Function | Description |
|---|---|
| addDelay | Adds a fixed delay to the schedule's existing delay. |
| compensate | Adjusts delay by subtracting execution time. |
| delayed | Adds an initial delay before the first attempt. |
| jitter | Adds randomized jitter to delays. |
| modifyDelay | Transforms the delay of a schedule. |
Filtering
| Function | Description |
|---|---|
| untilScheduleInput | Continues until the input satisfies a predicate. |
| untilScheduleOutput | Continues until the output satisfies a predicate. |
| whileScheduleInput | Continues while the input satisfies a predicate. |
| whileScheduleOutput | Continues while the output satisfies a predicate. |
State
| Function | Description |
|---|---|
| resetScheduleAfter | Resets the schedule after a period of inactivity. |
Transform
| Function | Description |
|---|---|
| delays | Outputs the delay between recurrences. |
| foldSchedule | Folds over the outputs of a schedule, accumulating state. |
| mapSchedule | Transforms the output of a schedule. |
| passthrough | Creates a schedule that outputs its input, or wraps an existing schedule to output input instead of the original output. |
| repetitions | Wraps a schedule to output the number of repetitions instead of original output. |
Collection
| Function | Description |
|---|---|
| collectAllScheduleOutputs | Collects all outputs into an array. |
| collectScheduleInputs | Collects all inputs into an array. |
| collectUntilScheduleOutput | Collects outputs until a predicate becomes true. |
| collectWhileScheduleOutput | Collects outputs while a predicate is true. |
Side effects
| Function | Description |
|---|---|
| tapScheduleInput | Executes a side effect for every input without altering the schedule. |
| tapScheduleOutput | Executes a side effect for every output without altering the schedule. |
Retry Strategies
| Variable | Description |
|---|---|
| retryStrategyAws | AWS standard retry strategy. |
Type Aliases
| Type Alias | Description |
|---|---|
| Schedule | Composable scheduling strategies for retry, repeat, rate limiting, and more. |
| ScheduleDeps | Dependencies provided to a Schedule. |