123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- // @flow
- import type { Stream, Sink, Scheduler, Task, Disposable, Time, Period, Delay } from '@most/types'
- export type SeedValue <S, A> = {
- seed: S,
- value: A
- }
- declare export function runEffects <A> (s: Stream<A>, scheduler: Scheduler): Promise<void>
- declare export function runEffects <A> (s: Stream<A>): (scheduler: Scheduler) => Promise<void>
- declare export function run <A> (sink: Sink<A>, scheduler: Scheduler, s: Stream<A>): Disposable
- declare export function run <A> (sink: Sink<A>): (scheduler: Scheduler, s: Stream<A>) => Disposable
- declare export function run <A> (sink: Sink<A>, scheduler: Scheduler): (s: Stream<A>) => Disposable
- declare export function run <A> (sink: Sink<A>): (scheduler: Scheduler) => (s: Stream<A>) => Disposable
- declare export function empty (): Stream<any>
- declare export function never (): Stream<any>
- declare export function now <A> (a: A): Stream<A>
- declare export function at <A> (t: Time, a: A): Stream<A>
- declare export function at <A> (t: Time): (a: A) => Stream<A>
- export type RunStream<A> = (sink: Sink<A>, scheduler: Scheduler) => Disposable
- declare export function newStream <A> (run: RunStream<A>): Stream<A>
- declare export function startWith <A> (a: A, s: Stream<A>): Stream<A>
- declare export function startWith <A> (a: A): (s: Stream<A>) => Stream<A>
- declare export function periodic (period: Period): Stream<void>
- declare export function map <A, B> (f: (A) => B, s: Stream<A>): Stream<B>
- declare export function map <A, B> (f: (A) => B): (s: Stream<A>) => Stream<B>
- declare export function constant <A, B> (a: A, s: Stream<B>): Stream<A>
- declare export function constant <A, B> (a: A): (s: Stream<B>) => Stream<A>
- declare export function tap <A> (f: (A) => any, s: Stream<A>): Stream<A>
- declare export function tap <A> (f: (A) => any): (s: Stream<A>) => Stream<A>
- declare export function scan <A, B> (f: (B, A) => B, b: B, s: Stream<A>): Stream<B>
- declare export function scan <A, B> (f: (B, A) => B): (b: B, s: Stream<A>) => Stream<B>
- declare export function scan <A, B> (f: (B, A) => B, b: B): (s: Stream<A>) => Stream<B>
- declare export function scan <A, B> (f: (B, A) => B): (b: B) => (s: Stream<A>) => Stream<B>
- declare export function loop <A, B, S> (f: (S, A) => SeedValue<S, B>, seed: S, s: Stream<A>): Stream<B>
- declare export function loop <A, B, S> (f: (S, A) => SeedValue<S, B>): (seed: S, s: Stream<A>) => Stream<B>
- declare export function loop <A, B, S> (f: (S, A) => SeedValue<S, B>, seed: S): (s: Stream<A>) => Stream<B>
- declare export function loop <A, B, S> (f: (S, A) => SeedValue<S, B>): (seed: S) => (s: Stream<A>) => Stream<B>
- declare export function ap <A, B> (fs: Stream<(A) => B>, s: Stream<A>): Stream<B>
- declare export function ap <A, B> (fs: Stream<(A) => B>): (s: Stream<A>) => Stream<B>
- declare export function chain <A, B> (f: (A) => Stream<B>, s: Stream<A>): Stream<B>
- declare export function chain <A, B> (f: (A) => Stream<B>): (s: Stream<A>) => Stream<B>
- declare export function join <A> (s: Stream<Stream<A>>): Stream<A>
- declare export function concatMap <A, B> (f: (A) => Stream<B>, s: Stream<A>): Stream<B>
- declare export function concatMap <A, B> (f: (A) => Stream<B>): (s: Stream<A>) => Stream<B>
- declare export function mergeConcurrently <A> (concurrency: number, s: Stream<Stream<A>>): Stream<A>
- declare export function mergeConcurrently <A> (concurrency: number): (s: Stream<Stream<A>>) => Stream<A>
- declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>, concurrency: number, s: Stream<A>): Stream<B>
- declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>, concurrency: number): (s: Stream<A>) => Stream<B>
- declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>): {
- (concurrency: number, s: Stream<A>): Stream<B>,
- (concurrency: number): (s: Stream<A>) => Stream<B>
- }
- declare export function continueWith <A> (f: (any) => Stream<A>, s: Stream<A>): Stream<A>
- declare export function continueWith <A> (f: (any) => Stream<A>): (s: Stream<A>) => Stream<A>
- declare export function switchLatest <A> (s: Stream<Stream<A>>): Stream<A>
- declare export function merge <A, B> (s1: Stream<A>, s2: Stream<B>): Stream<A | B>
- declare export function merge <A, B> (s1: Stream<A>): (s2: Stream<B>) => Stream<A | B>
- type MergeArray = <A>($ReadOnlyArray<Stream<A>>) => Stream<A>
- declare export function mergeArray <S> (ss: S): $Call<MergeArray, S>
- declare export function sample <A> (values: Stream<A>, sampler: Stream<any>): Stream<A>
- declare export function sample <A> (values: Stream<A>): (sampler: Stream<any>) => Stream<A>
- declare export function snapshot <A, B, C> (f: (A, B) => C, values: Stream<A>, sampler: Stream<B>): Stream<C>
- declare export function snapshot <A, B, C> (f: (A, B) => C): (values: Stream<A>, sampler: Stream<B>) => Stream<C>
- declare export function snapshot <A, B, C> (f: (A, B) => C, values: Stream<A>): (sampler: Stream<B>) => Stream<C>
- declare export function snapshot <A, B, C> (f: (A, B) => C): (values: Stream<A>) => (sampler: Stream<B>) => Stream<C>
- declare export function combine <A, B, Z> (f: (A, B) => Z, sa: Stream<A>, sb: Stream<B>): Stream<Z>
- declare export function combine <A, B, Z> (f: (A, B) => Z): (sa: Stream<A>, sb: Stream<B>) => Stream<Z>
- declare export function combine <A, B, Z> (f: (A, B) => Z, sa: Stream<A>): (sb: Stream<B>) => Stream<Z>
- declare export function combine <A, B, Z> (f: (A, B) => Z): (sa: Stream<A>) => (sb: Stream<B>) => Stream<Z>
- declare export function combineArray <A, B, Z> (f: (A, B) => Z, ss: [Stream<A>, Stream<B>]): Stream<Z>
- declare export function combineArray <A, B, Z> (f: (A, B) => Z): (ss: [Stream<A>, Stream<B>]) => Stream<Z>
- declare export function combineArray <A, B, C, Z> (f: (A, B, C) => Z, ss: [Stream<A>, Stream<B>, Stream<C>]): Stream<Z>
- declare export function combineArray <A, B, C, Z> (f: (A, B, C) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>]) => Stream<Z>
- declare export function combineArray <A, B, C, D, Z> (f: (A, B, C, D) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>]): Stream<Z>
- declare export function combineArray <A, B, C, D, Z> (f: (A, B, C, D) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>]) => Stream<Z>
- declare export function combineArray <A, B, C, D, E, Z> (f: (A, B, C, D, E) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>]): Stream<Z>
- declare export function combineArray <A, B, C, D, E, Z> (f: (A, B, C, D, E) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>]) => Stream<Z>
- declare export function combineArray <A, B, C, D, E, F, Z> (f: (A, B, C, D, E, F) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>, Stream<F>]): Stream<Z>
- declare export function combineArray <A, B, C, D, E, F, Z> (f: (A, B, C, D, E, F) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>, Stream<F>]) => Stream<Z>
- // Catch-all combineArray
- declare export function combineArray <Z> (f: (...rest: Array<any>) => Z, ss: Array<Stream<any>>): Stream<Z>
- declare export function combineArray <Z> (f: (...rest: Array<any>) => Z): (ss: Array<Stream<any>>) => Stream<Z>
- declare export function zip <A, B, Z> (f: (A, B) => Z, sa: Stream<A>, sb: Stream<B>): Stream<Z>
- declare export function zip <A, B, Z> (f: (A, B) => Z): (sa: Stream<A>, sb: Stream<B>) => Stream<Z>
- declare export function zip <A, B, Z> (f: (A, B) => Z, sa: Stream<A>): (sb: Stream<B>) => Stream<Z>
- declare export function zip <A, B, Z> (f: (A, B) => Z): (sa: Stream<A>) => (sb: Stream<B>) => Stream<Z>
- declare export function zipArray <A, B, Z> (f: (A, B) => Z, ss: [Stream<A>, Stream<B>]): Stream<Z>
- declare export function zipArray <A, B, Z> (f: (A, B) => Z): (ss: [Stream<A>, Stream<B>]) => Stream<Z>
- declare export function zipArray <A, B, C, Z> (f: (A, B, C) => Z, ss: [Stream<A>, Stream<B>, Stream<C>]): Stream<Z>
- declare export function zipArray <A, B, C, Z> (f: (A, B, C) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>]) => Stream<Z>
- declare export function zipArray <A, B, C, D, Z> (f: (A, B, C, D) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>]): Stream<Z>
- declare export function zipArray <A, B, C, D, Z> (f: (A, B, C, D) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>]) => Stream<Z>
- declare export function zipArray <A, B, C, D, E, Z> (f: (A, B, C, D, E) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>]): Stream<Z>
- declare export function zipArray <A, B, C, D, E, Z> (f: (A, B, C, D, E) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>]) => Stream<Z>
- declare export function zipArray <A, B, C, D, E, F, Z> (f: (A, B, C, D, E, F) => Z, ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>, Stream<F>]): Stream<Z>
- declare export function zipArray <A, B, C, D, E, F, Z> (f: (A, B, C, D, E, F) => Z): (ss: [Stream<A>, Stream<B>, Stream<C>, Stream<D>, Stream<E>, Stream<F>]) => Stream<Z>
- // Catch-all zipArray
- declare export function zipArray <Z> (f: (...rest: Array<any>) => Z, ss: Array<Stream<any>>): Stream<Z>
- declare export function zipArray <Z> (f: (...rest: Array<any>) => Z): (ss: Array<Stream<any>>) => Stream<Z>
- declare export function withItems <A> (a: Array<A>, s: Stream<any>): Stream<A>
- declare export function withItems <A> (a: Array<A>): (s: Stream<any>) => Stream<A>
- declare export function zipItems <A, B, C> (f: (A, B) => C, a: Array<A>, s: Stream<B>): Stream<C>
- declare export function zipItems <A, B, C> (f: (A, B) => C): (a: Array<A>, s: Stream<B>) => Stream<C>
- declare export function zipItems <A, B, C> (f: (A, B) => C, a: Array<A>): (s: Stream<B>) => Stream<C>
- declare export function zipItems <A, B, C> (f: (A, B) => C): (a: Array<A>) => (s: Stream<B>) => Stream<C>
- declare export function filter <A> (p: (A) => boolean, s: Stream<A>): Stream<A>
- declare export function filter <A> (p: (A) => boolean): (s: Stream<A>) => Stream<A>
- declare export function skipRepeats <A> (s: Stream<A>): Stream<A>
- declare export function skipRepeatsWith <A> (equals: (a1: A, a2: A) => boolean, s: Stream<A>): Stream<A>
- declare export function skipRepeatsWith <A> (equals: (a1: A, a2: A) => boolean): (s: Stream<A>) => Stream<A>
- declare export function take <A> (n: number, s: Stream<A>): Stream<A>
- declare export function take <A> (n: number): (s: Stream<A>) => Stream<A>
- declare export function skip <A> (n: number, s: Stream<A>): Stream<A>
- declare export function skip <A> (n: number): (s: Stream<A>) => Stream<A>
- declare export function slice <A> (start: number, end: number, s: Stream<A>): Stream<A>
- declare export function slice <A> (start: number): (end: number, s: Stream<A>) => Stream<A>
- declare export function slice <A> (start: number, end: number): (s: Stream<A>) => Stream<A>
- declare export function slice <A> (start: number): (end: number) => (s: Stream<A>) => Stream<A>
- declare export function takeWhile <A> (p: (A) => boolean, s: Stream<A>): Stream<A>
- declare export function takeWhile <A> (p: (A) => boolean): (s: Stream<A>) => Stream<A>
- declare export function skipWhile <A> (p: (A) => boolean, s: Stream<A>): Stream<A>
- declare export function skipWhile <A> (p: (A) => boolean): (s: Stream<A>) => Stream<A>
- declare export function skipAfter <A> (p: (A) => boolean, s: Stream<A>): Stream<A>
- declare export function skipAfter <A> (p: (A) => boolean): (s: Stream<A>) => Stream<A>
- declare export function until <A> (until: Stream<any>, s: Stream<A>): Stream<A>
- declare export function until <A> (until: Stream<any>): (s: Stream<A>) => Stream<A>
- declare export function since <A> (since: Stream<any>, s: Stream<A>): Stream<A>
- declare export function since <A> (since: Stream<any>): (s: Stream<A>) => Stream<A>
- declare export function during <A> (since: Stream<Stream<any>>, s: Stream<A>): Stream<A>
- declare export function withLocalTime <A> (origin: Time, s: Stream<A>): Stream<A>
- declare export function withLocalTime <A> (origin: Time): (s: Stream<A>) => Stream<A>
- declare export function delay <A> (delay: Delay, s: Stream<A>): Stream<A>
- declare export function delay <A> (delay: Delay): (s: Stream<A>) => Stream<A>
- declare export function throttle <A> (period: Period, s: Stream<A>): Stream<A>
- declare export function throttle <A> (period: Period): (s: Stream<A>) => Stream<A>
- declare export function debounce <A> (period: Period, s: Stream<A>): Stream<A>
- declare export function debounce <A> (period: Period): (s: Stream<A>) => Stream<A>
- declare export function fromPromise <A> (pa: Promise<A>): Stream<A>
- declare export function awaitPromises <A> (spa: Stream<Promise<A>>): Stream<A>
- declare export function recoverWith <A, E:Error> (f: (E) => Stream<A>, s: Stream<A>): Stream<A>
- declare export function recoverWith <A, E:Error> (f: (E) => Stream<A>): (s: Stream<A>) => Stream<A>
- declare export function throwError <E:Error> (e: Error): Stream<any>
- declare export function multicast <A> (s: Stream<A>): Stream<A>
- declare export class MulticastSource <A> {
- source: Stream<A>;
- sinks: Array<Sink<A>>;
- disposable: Disposable;
- constructor(Stream<A>): MulticastSource<A>;
- run(Sink<A>, Scheduler): Disposable;
- event(Time, A): void;
- error(Time, Error): void;
- end(Time): void;
- add(Sink<A>): number;
- remove(Sink<A>): number;
- dispose(): void;
- }
- export type PropagateTask<A, B> = Task & {
- value: A,
- sink: Sink<B>,
- active: boolean
- }
- export type PropagateTaskRun<A, B> = (time: Time, value: A, sink: Sink<B>) => any
- declare export function propagateTask<A, B> (run: PropagateTaskRun<A, B>, value: A, sink: Sink<B>): PropagateTask<A, B>
- declare export function propagateEventTask<A> (value: A, sink: Sink<A>): PropagateTask<A, A>
- declare export function propagateErrorTask<E: Error> (e: E, sink: Sink<any>): PropagateTask<any, any>
- declare export function propagateEndTask (sink: Sink<any>): PropagateTask<void, void>
|