/** * @since 1.0.0 */ import type * as Chunk from "@effect/data/Chunk" import type * as Context from "@effect/data/Context" import type * as Duration from "@effect/data/Duration" import type * as Either from "@effect/data/Either" import type { LazyArg } from "@effect/data/Function" import type * as Option from "@effect/data/Option" import type { Pipeable } from "@effect/data/Pipeable" import type { Predicate } from "@effect/data/Predicate" import type * as Cause from "@effect/io/Cause" import type * as Effect from "@effect/io/Effect" import * as internal from "@effect/io/internal/schedule" import type * as ScheduleDecision from "@effect/io/ScheduleDecision" import type * as Intervals from "@effect/io/ScheduleIntervals" /** * @since 1.0.0 * @category symbols */ export const ScheduleTypeId: unique symbol = internal.ScheduleTypeId /** * @since 1.0.0 * @category symbols */ export type ScheduleTypeId = typeof ScheduleTypeId /** * @since 1.0.0 * @category symbols */ export const ScheduleDriverTypeId: unique symbol = internal.ScheduleDriverTypeId /** * @since 1.0.0 * @category symbols */ export type ScheduleDriverTypeId = typeof ScheduleDriverTypeId /** * A `Schedule` defines a recurring schedule, which consumes * values of type `In`, and which returns values of type `Out`. * * Schedules are defined as a possibly infinite set of intervals spread out over * time. Each interval defines a window in which recurrence is possible. * * When schedules are used to repeat or retry effects, the starting boundary of * each interval produced by a schedule is used as the moment when the effect * will be executed again. * * Schedules compose in the following primary ways: * * - Union: performs the union of the intervals of two schedules * - Intersection: performs the intersection of the intervals of two schedules * - Sequence: concatenates the intervals of one schedule onto another * * In addition, schedule inputs and outputs can be transformed, filtered (to * terminate a schedule early in response to some input or output), and so * forth. * * A variety of other operators exist for transforming and combining schedules, * and the companion object for `Schedule` contains all common types of * schedules, both for performing retrying, as well as performing repetition. * * @category model * @since 1.0.0 */ export interface Schedule extends Schedule.Variance, Pipeable { /** * Initial State */ readonly initial: any /** * Schedule Step */ readonly step: ( now: number, input: In, state: any ) => Effect.Effect } /** * @since 1.0.0 */ export declare namespace Schedule { /** * @since 1.0.0 * @category models */ export interface Variance { readonly [ScheduleTypeId]: { readonly _Env: (_: never) => Env readonly _In: (_: In) => void readonly _Out: (_: never) => Out } } /** * @since 1.0.0 */ export interface DriverVariance { readonly [ScheduleDriverTypeId]: { readonly _Env: (_: never) => Env readonly _In: (_: In) => void readonly _Out: (_: never) => Out } } } /** * @since 1.0.0 * @category models */ export interface ScheduleDriver extends Schedule.DriverVariance { state(): Effect.Effect last(): Effect.Effect reset(): Effect.Effect next(input: In): Effect.Effect, Out> } /** * Constructs a new `Schedule` with the specified `initial` state and the * specified `step` function. * * @since 1.0.0 * @category constructors */ export const makeWithState: ( initial: S, step: ( now: number, input: In, state: S ) => Effect.Effect ) => Schedule = internal.makeWithState /** * Returns a new schedule with the given delay added to every interval defined * by this schedule. * * @since 1.0.0 * @category utils */ export const addDelay: { (f: (out: Out) => Duration.DurationInput): (self: Schedule) => Schedule (self: Schedule, f: (out: Out) => Duration.DurationInput): Schedule } = internal.addDelay /** * Returns a new schedule with the given effectfully computed delay added to * every interval defined by this schedule. * * @since 1.0.0 * @category utils */ export const addDelayEffect: { ( f: (out: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out) => Effect.Effect ): Schedule } = internal.addDelayEffect /** * The same as `andThenEither`, but merges the output. * * @since 1.0.0 * @category sequencing */ export const andThen: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.andThen /** * Returns a new schedule that first executes this schedule to completion, and * then executes the specified schedule to completion. * * @since 1.0.0 * @category sequencing */ export const andThenEither: { ( that: Schedule ): (self: Schedule) => Schedule> ( self: Schedule, that: Schedule ): Schedule> } = internal.andThenEither /** * Returns a new schedule that maps this schedule to a constant output. * * @since 1.0.0 * @category mapping */ export const as: { (out: Out2): (self: Schedule) => Schedule (self: Schedule, out: Out2): Schedule } = internal.as /** * Returns a new schedule that maps the output of this schedule to unit. * * @since 1.0.0 * @category constructors */ export const asUnit: (self: Schedule) => Schedule = internal.asUnit /** * Returns a new schedule that has both the inputs and outputs of this and the * specified schedule. * * @since 1.0.0 * @category utils */ export const bothInOut: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.bothInOut /** * Returns a new schedule that passes each input and output of this schedule * to the specified function, and then determines whether or not to continue * based on the return value of the function. * * @since 1.0.0 * @category utils */ export const check: { (test: (input: In, output: Out) => boolean): (self: Schedule) => Schedule (self: Schedule, test: (input: In, output: Out) => boolean): Schedule } = internal.check /** * Returns a new schedule that passes each input and output of this schedule * to the specified function, and then determines whether or not to continue * based on the return value of the function. * * @since 1.0.0 * @category utils */ export const checkEffect: { ( test: (input: In, output: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, test: (input: In, output: Out) => Effect.Effect ): Schedule } = internal.checkEffect /** * A schedule that recurs anywhere, collecting all inputs into a `Chunk`. * * @since 1.0.0 * @category constructors */ export const collectAllInputs: () => Schedule> = internal.collectAllInputs /** * Returns a new schedule that collects the outputs of this one into a chunk. * * @since 1.0.0 * @category utils */ export const collectAllOutputs: (self: Schedule) => Schedule> = internal.collectAllOutputs /** * A schedule that recurs until the condition f fails, collecting all inputs * into a list. * * @since 1.0.0 * @category utils */ export const collectUntil: (f: Predicate) => Schedule> = internal.collectUntil /** * A schedule that recurs until the effectful condition f fails, collecting * all inputs into a list. * * @since 1.0.0 * @category utils */ export const collectUntilEffect: ( f: (a: A) => Effect.Effect ) => Schedule> = internal.collectUntilEffect /** * A schedule that recurs as long as the condition f holds, collecting all * inputs into a list. * * @since 1.0.0 * @category utils */ export const collectWhile: (f: Predicate) => Schedule> = internal.collectWhile /** * A schedule that recurs as long as the effectful condition holds, collecting * all inputs into a list. * * @category utils * @since 1.0.0 */ export const collectWhileEffect: ( f: (a: A) => Effect.Effect ) => Schedule> = internal.collectWhileEffect /** * Returns the composition of this schedule and the specified schedule, by * piping the output of this one into the input of the other. Effects * described by this schedule will always be executed before the effects * described by the second schedule. * * @since 1.0.0 * @category utils */ export const compose: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.compose /** * Returns a new schedule that deals with a narrower class of inputs than this * schedule. * * @since 1.0.0 * @category mapping */ export const mapInput: { (f: (in2: In2) => In): (self: Schedule) => Schedule (self: Schedule, f: (in2: In2) => In): Schedule } = internal.mapInput /** * Transforms the context being provided to this schedule with the * specified function. * * @since 1.0.0 * @category context */ export const mapInputContext: { ( f: (env0: Context.Context) => Context.Context ): (self: Schedule) => Schedule ( self: Schedule, f: (env0: Context.Context) => Context.Context ): Schedule } = internal.mapInputContext /** * Returns a new schedule that deals with a narrower class of inputs than this * schedule. * * @since 1.0.0 * @category mapping */ export const mapInputEffect: { ( f: (in2: In2) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (in2: In2) => Effect.Effect ): Schedule } = internal.mapInputEffect /** * A schedule that always recurs, which counts the number of recurrences. * * @since 1.0.0 * @category constructors */ export const count: Schedule = internal.count /** * Cron-like schedule that recurs every specified `day` of month. Won't recur * on months containing less days than specified in `day` param. * * It triggers at zero hour of the day. Producing a count of repeats: 0, 1, 2. * * NOTE: `day` parameter is validated lazily. Must be in range 1...31. * * @since 1.0.0 * @category constructors */ export const dayOfMonth: (day: number) => Schedule = internal.dayOfMonth /** * Cron-like schedule that recurs every specified `day` of each week. It * triggers at zero hour of the week. Producing a count of repeats: 0, 1, 2. * * NOTE: `day` parameter is validated lazily. Must be in range 1 (Monday)...7 * (Sunday). * * @since 1.0.0 * @category constructors */ export const dayOfWeek: (day: number) => Schedule = internal.dayOfWeek /** * Returns a new schedule with the specified effectfully computed delay added * before the start of each interval produced by this schedule. * * @since 1.0.0 * @category utils */ export const delayed: { ( f: (duration: Duration.Duration) => Duration.DurationInput ): (self: Schedule) => Schedule ( self: Schedule, f: (duration: Duration.Duration) => Duration.DurationInput ): Schedule } = internal.delayed /** * Returns a new schedule with the specified effectfully computed delay added * before the start of each interval produced by this schedule. * * @since 1.0.0 * @category constructors */ export const delayedEffect: { ( f: (duration: Duration.Duration) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (duration: Duration.Duration) => Effect.Effect ): Schedule } = internal.delayedEffect /** * Takes a schedule that produces a delay, and returns a new schedule that * uses this delay to further delay intervals in the resulting schedule. * * @since 1.0.0 * @category constructors */ export const delayedSchedule: ( schedule: Schedule ) => Schedule = internal.delayedSchedule /** * Returns a new schedule that outputs the delay between each occurence. * * @since 1.0.0 * @category constructors */ export const delays: (self: Schedule) => Schedule = internal.delays /** * Returns a new schedule that maps both the input and output. * * @since 1.0.0 * @category mapping */ export const mapBoth: { ( options: { readonly onInput: (in2: In2) => In readonly onOutput: (out: Out) => Out2 } ): (self: Schedule) => Schedule ( self: Schedule, options: { readonly onInput: (in2: In2) => In readonly onOutput: (out: Out) => Out2 } ): Schedule } = internal.mapBoth /** * Returns a new schedule that maps both the input and output. * * @since 1.0.0 * @category mapping */ export const mapBothEffect: { ( options: { readonly onInput: (input: In2) => Effect.Effect readonly onOutput: (out: Out) => Effect.Effect } ): (self: Schedule) => Schedule ( self: Schedule, options: { readonly onInput: (input: In2) => Effect.Effect readonly onOutput: (out: Out) => Effect.Effect } ): Schedule } = internal.mapBothEffect /** * Returns a driver that can be used to step the schedule, appropriately * handling sleeping. * * @since 1.0.0 * @category getter */ export const driver: ( self: Schedule ) => Effect.Effect> = internal.driver /** * A schedule that can recur one time, the specified amount of time into the * future. * * @since 1.0.0 * @category constructors */ export const duration: (duration: Duration.DurationInput) => Schedule = internal.duration /** * Returns a new schedule that performs a geometric union on the intervals * defined by both schedules. * * @since 1.0.0 * @category alternatives */ export const either: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.either /** * The same as `either` followed by `map`. * * @since 1.0.0 * @category alternatives */ export const eitherWith: { ( that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): Schedule } = internal.eitherWith /** * A schedule that occurs everywhere, which returns the total elapsed duration * since the first step. * * @since 1.0.0 * @category constructors */ export const elapsed: Schedule = internal.elapsed /** * Returns a new schedule that will run the specified finalizer as soon as the * schedule is complete. Note that unlike `Effect.ensuring`, this method does not * guarantee the finalizer will be run. The `Schedule` may not initialize or * the driver of the schedule may not run to completion. However, if the * `Schedule` ever decides not to continue, then the finalizer will be run. * * @since 1.0.0 * @category finalization */ export const ensuring: { (finalizer: Effect.Effect): (self: Schedule) => Schedule (self: Schedule, finalizer: Effect.Effect): Schedule } = internal.ensuring /** * A schedule that always recurs, but will wait a certain amount between * repetitions, given by `base * factor.pow(n)`, where `n` is the number of * repetitions so far. Returns the current duration between recurrences. * * @since 1.0.0 * @category constructors */ export const exponential: ( base: Duration.DurationInput, factor?: number ) => Schedule = internal.exponential /** * A schedule that always recurs, increasing delays by summing the preceding * two delays (similar to the fibonacci sequence). Returns the current * duration between recurrences. * * @since 1.0.0 * @category constructors */ export const fibonacci: (one: Duration.DurationInput) => Schedule = internal.fibonacci /** * A schedule that recurs on a fixed interval. Returns the number of * repetitions of the schedule so far. * * If the action run between updates takes longer than the interval, then the * action will be run immediately, but re-runs will not "pile up". * * ``` * |-----interval-----|-----interval-----|-----interval-----| * |---------action--------||action|-----|action|-----------| * ``` * * @since 1.0.0 * @category constructors */ export const fixed: (interval: Duration.DurationInput) => Schedule = internal.fixed /** * A schedule that always recurs, producing a count of repeats: 0, 1, 2. * * @since 1.0.0 * @category constructors */ export const forever: Schedule = internal.forever /** * A schedule that recurs once with the specified delay. * * @since 1.0.0 * @category constructors */ export const fromDelay: (delay: Duration.DurationInput) => Schedule = internal.fromDelay /** * A schedule that recurs once for each of the specified durations, delaying * each time for the length of the specified duration. Returns the length of * the current duration between recurrences. * * @since 1.0.0 * @category constructors */ export const fromDelays: ( delay: Duration.DurationInput, ...delays: Array ) => Schedule = internal.fromDelays /** * A schedule that always recurs, mapping input values through the specified * function. * * @since 1.0.0 * @category constructors */ export const fromFunction: (f: (a: A) => B) => Schedule = internal.fromFunction /** * Cron-like schedule that recurs every specified `hour` of each day. It * triggers at zero minute of the hour. Producing a count of repeats: 0, 1, 2. * * NOTE: `hour` parameter is validated lazily. Must be in range 0...23. * * @since 1.0.0 * @category constructors */ export const hourOfDay: (hour: number) => Schedule = internal.hourOfDay /** * A schedule that always recurs, which returns inputs as outputs. * * @since 1.0.0 * @category constructors */ export const identity: () => Schedule = internal.identity /** * Returns a new schedule that performs a geometric intersection on the * intervals defined by both schedules. * * @since 1.0.0 * @category utils */ export const intersect: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.intersect /** * Returns a new schedule that combines this schedule with the specified * schedule, continuing as long as both schedules want to continue and merging * the next intervals according to the specified merge function. * * @since 1.0.0 * @category utils */ export const intersectWith: { ( that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): Schedule } = internal.intersectWith /** * Returns a new schedule that randomly modifies the size of the intervals of * this schedule. * * Defaults `min` to `0.8` and `max` to `1.2`. * * The new interval size is between `min * old interval size` and `max * old * interval size`. * * @since 1.0.0 * @category constructors */ export const jittered: (self: Schedule) => Schedule = internal.jittered /** * Returns a new schedule that randomly modifies the size of the intervals of * this schedule. * * The new interval size is between `min * old interval size` and `max * old * interval size`. * * @since 1.0.0 * @category constructors */ export const jitteredWith: { (options: { min?: number; max?: number }): ( self: Schedule ) => Schedule ( self: Schedule, options: { min?: number; max?: number } ): Schedule } = internal.jitteredWith /** * A schedule that always recurs, but will repeat on a linear time interval, * given by `base * n` where `n` is the number of repetitions so far. Returns * the current duration between recurrences. * * @since 1.0.0 * @category constructors */ export const linear: (base: Duration.DurationInput) => Schedule = internal.linear /** * Returns a new schedule that maps the output of this schedule through the * specified function. * * @since 1.0.0 * @category mapping */ export const map: { (f: (out: Out) => Out2): (self: Schedule) => Schedule (self: Schedule, f: (out: Out) => Out2): Schedule } = internal.map /** * Returns a new schedule that maps the output of this schedule through the * specified effectful function. * * @since 1.0.0 * @category mapping */ export const mapEffect: { ( f: (out: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out) => Effect.Effect ): Schedule } = internal.mapEffect /** * Cron-like schedule that recurs every specified `minute` of each hour. It * triggers at zero second of the minute. Producing a count of repeats: 0, 1, * 2. * * NOTE: `minute` parameter is validated lazily. Must be in range 0...59. * * @since 1.0.0 * @category constructors */ export const minuteOfHour: (minute: number) => Schedule = internal.minuteOfHour /** * Returns a new schedule that modifies the delay using the specified * function. * * @since 1.0.0 * @category utils */ export const modifyDelay: { ( f: (out: Out, duration: Duration.Duration) => Duration.DurationInput ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out, duration: Duration.Duration) => Duration.DurationInput ): Schedule } = internal.modifyDelay /** * Returns a new schedule that modifies the delay using the specified * effectual function. * * @since 1.0.0 * @category utils */ export const modifyDelayEffect: { ( f: (out: Out, duration: Duration.Duration) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out, duration: Duration.Duration) => Effect.Effect ): Schedule } = internal.modifyDelayEffect /** * Returns a new schedule that applies the current one but runs the specified * effect for every decision of this schedule. This can be used to create * schedules that log failures, decisions, or computed values. * * @since 1.0.0 * @category utils */ export const onDecision: { ( f: (out: Out, decision: ScheduleDecision.ScheduleDecision) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out, decision: ScheduleDecision.ScheduleDecision) => Effect.Effect ): Schedule } = internal.onDecision /** * A schedule that recurs one time. * * @since 1.0.0 * @category constructors */ export const once: Schedule = internal.once /** * Returns a new schedule that passes through the inputs of this schedule. * * @since 1.0.0 * @category utils */ export const passthrough: (self: Schedule) => Schedule = internal.passthrough /** * Returns a new schedule with its context provided to it, so the * resulting schedule does not require any context. * * @since 1.0.0 * @category context */ export const provideContext: { (context: Context.Context): (self: Schedule) => Schedule (self: Schedule, context: Context.Context): Schedule } = internal.provideContext /** * Returns a new schedule with the single service it requires provided to it. * If the schedule requires multiple services use `provideContext` * instead. * * @since 1.0.0 * @category context */ export const provideService: { ( tag: any, service: T1 ): (self: Schedule) => Schedule, In, Out> ( self: Schedule, tag: any, service: T1 ): Schedule, In, Out> } = internal.provideService /** * A schedule that recurs for until the predicate evaluates to true. * * @since 1.0.0 * @category utils */ export const recurUntil: (f: Predicate) => Schedule = internal.recurUntil /** * A schedule that recurs for until the predicate evaluates to true. * * @since 1.0.0 * @category utils */ export const recurUntilEffect: (f: (a: A) => Effect.Effect) => Schedule = internal.recurUntilEffect /** * A schedule that recurs for until the input value becomes applicable to * partial function and then map that value with given function. * * @since 1.0.0 * @category utils */ export const recurUntilOption: (pf: (a: A) => Option.Option) => Schedule> = internal.recurUntilOption /** * A schedule that recurs during the given duration. * * @since 1.0.0 * @category utils */ export const recurUpTo: (duration: Duration.DurationInput) => Schedule = internal.recurUpTo /** * A schedule that recurs for as long as the predicate evaluates to true. * * @since 1.0.0 * @category utils */ export const recurWhile: (f: Predicate) => Schedule = internal.recurWhile /** * A schedule that recurs for as long as the effectful predicate evaluates to * true. * * @since 1.0.0 * @category utils */ export const recurWhileEffect: (f: (a: A) => Effect.Effect) => Schedule = internal.recurWhileEffect /** * A schedule spanning all time, which can be stepped only the specified * number of times before it terminates. * * @category constructors * @since 1.0.0 */ export const recurs: (n: number) => Schedule = internal.recurs /** * Returns a new schedule that folds over the outputs of this one. * * @since 1.0.0 * @category folding */ export const reduce: { (zero: Z, f: (z: Z, out: Out) => Z): (self: Schedule) => Schedule (self: Schedule, zero: Z, f: (z: Z, out: Out) => Z): Schedule } = internal.reduce /** * Returns a new schedule that effectfully folds over the outputs of this one. * * @since 1.0.0 * @category folding */ export const reduceEffect: { ( zero: Z, f: (z: Z, out: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, zero: Z, f: (z: Z, out: Out) => Effect.Effect ): Schedule } = internal.reduceEffect /** * Returns a new schedule that loops this one continuously, resetting the * state when this schedule is done. * * @since 1.0.0 * @category constructors */ export const repeatForever: Schedule = internal.forever /** * Returns a new schedule that outputs the number of repetitions of this one. * * @since 1.0.0 * @category utils */ export const repetitions: (self: Schedule) => Schedule = internal.repetitions /** * Return a new schedule that automatically resets the schedule to its initial * state after some time of inactivity defined by `duration`. * * @since 1.0.0 * @category utils */ export const resetAfter: { (duration: Duration.DurationInput): (self: Schedule) => Schedule (self: Schedule, duration: Duration.DurationInput): Schedule } = internal.resetAfter /** * Resets the schedule when the specified predicate on the schedule output * evaluates to true. * * @since 1.0.0 * @category utils */ export const resetWhen: { (f: Predicate): (self: Schedule) => Schedule (self: Schedule, f: Predicate): Schedule } = internal.resetWhen /** * Runs a schedule using the provided inputs, and collects all outputs. * * @since 1.0.0 * @category destructors */ export const run: { ( now: number, input: Iterable ): (self: Schedule) => Effect.Effect> ( self: Schedule, now: number, input: Iterable ): Effect.Effect> } = internal.run /** * Cron-like schedule that recurs every specified `second` of each minute. It * triggers at zero nanosecond of the second. Producing a count of repeats: 0, * 1, 2. * * NOTE: `second` parameter is validated lazily. Must be in range 0...59. * * @since 1.0.0 * @category constructors */ export const secondOfMinute: (second: number) => Schedule = internal.secondOfMinute /** * Returns a schedule that recurs continuously, each repetition spaced the * specified duration from the last run. * * @since 1.0.0 * @category constructors */ export const spaced: (duration: Duration.DurationInput) => Schedule = internal.spaced /** * A schedule that does not recur, it just stops. * * @since 1.0.0 * @category constructors */ export const stop: Schedule = internal.stop /** * Returns a schedule that repeats one time, producing the specified constant * value. * * @since 1.0.0 * @category constructors */ export const succeed: (value: A) => Schedule = internal.succeed /** * Returns a schedule that repeats one time, producing the specified constant * value. * * @category constructors * @since 1.0.0 */ export const sync: (evaluate: LazyArg) => Schedule = internal.sync /** * Returns a new schedule that effectfully processes every input to this * schedule. * * @since 1.0.0 * @category sequencing */ export const tapInput: { ( f: (input: In2) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (input: In2) => Effect.Effect ): Schedule } = internal.tapInput /** * Returns a new schedule that effectfully processes every output from this * schedule. * * @since 1.0.0 * @category sequencing */ export const tapOutput: { ( f: (out: XO) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: XO) => Effect.Effect ): Schedule } = internal.tapOutput /** * Unfolds a schedule that repeats one time from the specified state and * iterator. * * @since 1.0.0 * @category constructors */ export const unfold: (initial: A, f: (a: A) => A) => Schedule = internal.unfold /** * Returns a new schedule that performs a geometric union on the intervals * defined by both schedules. * * @since 1.0.0 * @category utils */ export const union: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.union /** * Returns a new schedule that combines this schedule with the specified * schedule, continuing as long as either schedule wants to continue and * merging the next intervals according to the specified merge function. * * @since 1.0.0 * @category utils */ export const unionWith: { ( that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule, f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals ): Schedule } = internal.unionWith /** * Returns a new schedule that continues until the specified predicate on the * input evaluates to true. * * @since 1.0.0 * @category utils */ export const untilInput: { (f: Predicate): (self: Schedule) => Schedule (self: Schedule, f: Predicate): Schedule } = internal.untilInput /** * Returns a new schedule that continues until the specified effectful * predicate on the input evaluates to true. * * @since 1.0.0 * @category utils */ export const untilInputEffect: { ( f: (input: In) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (input: In) => Effect.Effect ): Schedule } = internal.untilInputEffect /** * Returns a new schedule that continues until the specified predicate on the * output evaluates to true. * * @since 1.0.0 * @category utils */ export const untilOutput: { (f: Predicate): (self: Schedule) => Schedule (self: Schedule, f: Predicate): Schedule } = internal.untilOutput /** * Returns a new schedule that continues until the specified effectful * predicate on the output evaluates to true. * * @since 1.0.0 * @category utils */ export const untilOutputEffect: { ( f: (out: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out) => Effect.Effect ): Schedule } = internal.untilOutputEffect /** * A schedule that recurs during the given duration. * * @since 1.0.0 * @category utils */ export const upTo: { (duration: Duration.DurationInput): (self: Schedule) => Schedule (self: Schedule, duration: Duration.DurationInput): Schedule } = internal.upTo /** * Returns a new schedule that continues for as long the specified predicate * on the input evaluates to true. * * @since 1.0.0 * @category utils */ export const whileInput: { (f: Predicate): (self: Schedule) => Schedule (self: Schedule, f: Predicate): Schedule } = internal.whileInput /** * Returns a new schedule that continues for as long the specified effectful * predicate on the input evaluates to true. * * @since 1.0.0 * @category utils */ export const whileInputEffect: { ( f: (input: In) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (input: In) => Effect.Effect ): Schedule } = internal.whileInputEffect /** * Returns a new schedule that continues for as long the specified predicate * on the output evaluates to true. * * @since 1.0.0 * @category utils */ export const whileOutput: { (f: Predicate): (self: Schedule) => Schedule (self: Schedule, f: Predicate): Schedule } = internal.whileOutput /** * Returns a new schedule that continues for as long the specified effectful * predicate on the output evaluates to true. * * @since 1.0.0 * @category utils */ export const whileOutputEffect: { ( f: (out: Out) => Effect.Effect ): (self: Schedule) => Schedule ( self: Schedule, f: (out: Out) => Effect.Effect ): Schedule } = internal.whileOutputEffect /** * A schedule that divides the timeline to `interval`-long windows, and sleeps * until the nearest window boundary every time it recurs. * * For example, `windowed(Duration.seconds(10))` would produce a schedule as * follows: * * ``` * 10s 10s 10s 10s * |----------|----------|----------|----------| * |action------|sleep---|act|-sleep|action----| * ``` * * @since 1.0.0 * @category constructors */ export const windowed: (interval: Duration.DurationInput) => Schedule = internal.windowed /** * The same as `intersect` but ignores the right output. * * @since 1.0.0 * @category zipping */ export const zipLeft: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.zipLeft /** * The same as `intersect` but ignores the left output. * * @since 1.0.0 * @category zipping */ export const zipRight: { ( that: Schedule ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule ): Schedule } = internal.zipRight /** * Equivalent to `intersect` followed by `map`. * * @since 1.0.0 * @category zipping */ export const zipWith: { ( that: Schedule, f: (out: Out, out2: Out2) => Out3 ): (self: Schedule) => Schedule ( self: Schedule, that: Schedule, f: (out: Out, out2: Out2) => Out3 ): Schedule } = internal.zipWith