aeon-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -0
- package/dist/adapter.d.ts +17 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/asyncIterator.d.ts +23 -0
- package/dist/asyncIterator.d.ts.map +1 -0
- package/dist/behavior.d.ts +140 -0
- package/dist/behavior.d.ts.map +1 -0
- package/dist/combinators/aggregate.d.ts +27 -0
- package/dist/combinators/aggregate.d.ts.map +1 -0
- package/dist/combinators/attach.d.ts +21 -0
- package/dist/combinators/attach.d.ts.map +1 -0
- package/dist/combinators/chain.d.ts +17 -0
- package/dist/combinators/chain.d.ts.map +1 -0
- package/dist/combinators/combine.d.ts +24 -0
- package/dist/combinators/combine.d.ts.map +1 -0
- package/dist/combinators/cons.d.ts +14 -0
- package/dist/combinators/cons.d.ts.map +1 -0
- package/dist/combinators/constant.d.ts +13 -0
- package/dist/combinators/constant.d.ts.map +1 -0
- package/dist/combinators/dedupe.d.ts +16 -0
- package/dist/combinators/dedupe.d.ts.map +1 -0
- package/dist/combinators/ensure.d.ts +13 -0
- package/dist/combinators/ensure.d.ts.map +1 -0
- package/dist/combinators/error.d.ts +29 -0
- package/dist/combinators/error.d.ts.map +1 -0
- package/dist/combinators/exhaustMap.d.ts +17 -0
- package/dist/combinators/exhaustMap.d.ts.map +1 -0
- package/dist/combinators/filter.d.ts +16 -0
- package/dist/combinators/filter.d.ts.map +1 -0
- package/dist/combinators/firstLast.d.ts +23 -0
- package/dist/combinators/firstLast.d.ts.map +1 -0
- package/dist/combinators/forkJoin.d.ts +14 -0
- package/dist/combinators/forkJoin.d.ts.map +1 -0
- package/dist/combinators/fromPromise.d.ts +17 -0
- package/dist/combinators/fromPromise.d.ts.map +1 -0
- package/dist/combinators/index.d.ts +31 -0
- package/dist/combinators/index.d.ts.map +1 -0
- package/dist/combinators/map.d.ts +16 -0
- package/dist/combinators/map.d.ts.map +1 -0
- package/dist/combinators/merge.d.ts +17 -0
- package/dist/combinators/merge.d.ts.map +1 -0
- package/dist/combinators/mergeMap.d.ts +18 -0
- package/dist/combinators/mergeMap.d.ts.map +1 -0
- package/dist/combinators/orElse.d.ts +14 -0
- package/dist/combinators/orElse.d.ts.map +1 -0
- package/dist/combinators/pairwise.d.ts +14 -0
- package/dist/combinators/pairwise.d.ts.map +1 -0
- package/dist/combinators/race.d.ts +13 -0
- package/dist/combinators/race.d.ts.map +1 -0
- package/dist/combinators/retry.d.ts +18 -0
- package/dist/combinators/retry.d.ts.map +1 -0
- package/dist/combinators/scan.d.ts +15 -0
- package/dist/combinators/scan.d.ts.map +1 -0
- package/dist/combinators/share.d.ts +22 -0
- package/dist/combinators/share.d.ts.map +1 -0
- package/dist/combinators/slice.d.ts +38 -0
- package/dist/combinators/slice.d.ts.map +1 -0
- package/dist/combinators/switch.d.ts +17 -0
- package/dist/combinators/switch.d.ts.map +1 -0
- package/dist/combinators/tap.d.ts +12 -0
- package/dist/combinators/tap.d.ts.map +1 -0
- package/dist/combinators/terminal.d.ts +32 -0
- package/dist/combinators/terminal.d.ts.map +1 -0
- package/dist/combinators/time.d.ts +40 -0
- package/dist/combinators/time.d.ts.map +1 -0
- package/dist/combinators/timeout.d.ts +20 -0
- package/dist/combinators/timeout.d.ts.map +1 -0
- package/dist/combinators/traverse.d.ts +21 -0
- package/dist/combinators/traverse.d.ts.map +1 -0
- package/dist/constructors.d.ts +72 -0
- package/dist/constructors.d.ts.map +1 -0
- package/dist/fluent.d.ts +83 -0
- package/dist/fluent.d.ts.map +1 -0
- package/dist/index.cjs +3648 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3564 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Pipe.d.ts +15 -0
- package/dist/internal/Pipe.d.ts.map +1 -0
- package/dist/internal/behavior.d.ts +62 -0
- package/dist/internal/behavior.d.ts.map +1 -0
- package/dist/internal/dispose.d.ts +16 -0
- package/dist/internal/dispose.d.ts.map +1 -0
- package/dist/internal/event.d.ts +25 -0
- package/dist/internal/event.d.ts.map +1 -0
- package/dist/internal/fusion.d.ts +32 -0
- package/dist/internal/fusion.d.ts.map +1 -0
- package/dist/internal/testScheduler.d.ts +22 -0
- package/dist/internal/testScheduler.d.ts.map +1 -0
- package/dist/multicast.d.ts +18 -0
- package/dist/multicast.d.ts.map +1 -0
- package/dist/pipe.d.ts +20 -0
- package/dist/pipe.d.ts.map +1 -0
- package/dist/pipeable.d.ts +55 -0
- package/dist/pipeable.d.ts.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# aeon-core
|
|
2
|
+
|
|
3
|
+
The main package of [Aeon](https://github.com/joshburgess/aeon), a denotationally-designed reactive programming library for TypeScript.
|
|
4
|
+
|
|
5
|
+
Aeon provides two core abstractions with precise mathematical semantics:
|
|
6
|
+
|
|
7
|
+
- **`Event<A, E>`** — a discrete stream of time-stamped values with a typed error channel
|
|
8
|
+
- **`Behavior<A, E>`** — a continuous function from time to a value, evaluated lazily when sampled
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Denotational semantics** — every combinator has a formal mathematical meaning
|
|
13
|
+
- **Typed error channel** — `E = never` means a stream provably cannot fail
|
|
14
|
+
- **V8-optimized** — monomorphic sink classes, hidden class discipline, construction-time pipeline fusion
|
|
15
|
+
- **Three API styles** — data-first composition, `pipe()` with data-last curried operators (`P.*`), fluent chainable methods
|
|
16
|
+
- **Behaviors** — continuous-time values with generation-based dirty-flag caching, plus numerical integration and differentiation
|
|
17
|
+
- **Comprehensive** — 50+ operators covering transforms, slicing, combining, higher-order, error handling, time, and aggregation
|
|
18
|
+
- **Small** — 1.5 KB gzipped minimal import, 8.3 KB full library
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add aeon-core aeon-scheduler
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { fromArray, map, filter, observe } from "aeon-core";
|
|
30
|
+
import { DefaultScheduler } from "aeon-scheduler";
|
|
31
|
+
|
|
32
|
+
const scheduler = new DefaultScheduler();
|
|
33
|
+
|
|
34
|
+
await observe(
|
|
35
|
+
(v) => console.log(v),
|
|
36
|
+
map(
|
|
37
|
+
(x) => x * 2,
|
|
38
|
+
filter((x) => x % 2 === 0, fromArray([1, 2, 3, 4, 5])),
|
|
39
|
+
),
|
|
40
|
+
scheduler,
|
|
41
|
+
);
|
|
42
|
+
// 4, 8
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Using `pipe`
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { fromArray, pipe, observe, P } from "aeon-core";
|
|
49
|
+
import { DefaultScheduler } from "aeon-scheduler";
|
|
50
|
+
|
|
51
|
+
const result = pipe(
|
|
52
|
+
fromArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
|
|
53
|
+
P.filter((x) => x % 2 === 0),
|
|
54
|
+
P.map((x) => x * 2),
|
|
55
|
+
P.take(3),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
await observe((v) => console.log(v), result, new DefaultScheduler());
|
|
59
|
+
// 4, 8, 12
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Using the fluent API
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { fromArray, fluent } from "aeon-core";
|
|
66
|
+
import { DefaultScheduler } from "aeon-scheduler";
|
|
67
|
+
|
|
68
|
+
await fluent(fromArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
|
|
69
|
+
.filter((x) => x % 2 === 0)
|
|
70
|
+
.map((x) => x * 2)
|
|
71
|
+
.take(3)
|
|
72
|
+
.observe((v) => console.log(v), new DefaultScheduler());
|
|
73
|
+
// 4, 8, 12
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
- [Main README](https://github.com/joshburgess/aeon#readme)
|
|
79
|
+
- [Getting Started](https://github.com/joshburgess/aeon/blob/main/docs/getting-started.md)
|
|
80
|
+
- [Denotational Semantics](https://github.com/joshburgess/aeon/blob/main/docs/semantics.md)
|
|
81
|
+
- [Optimizations](https://github.com/joshburgess/aeon/blob/main/OPTIMIZATIONS.md)
|
|
82
|
+
- [Migration from RxJS](https://github.com/joshburgess/aeon/blob/main/docs/migration-from-rxjs.md)
|
|
83
|
+
- [Migration from @most/core](https://github.com/joshburgess/aeon/blob/main/docs/migration-from-most.md)
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imperative push adapter.
|
|
3
|
+
*
|
|
4
|
+
* createAdapter returns a [push, event] pair. Calling push(value) sends
|
|
5
|
+
* the value to all current subscribers. This is the equivalent of
|
|
6
|
+
* RxJS's Subject, but as a clean separated push/pull pair.
|
|
7
|
+
*/
|
|
8
|
+
import type { Event } from "aeon-types";
|
|
9
|
+
/**
|
|
10
|
+
* Create an imperative push adapter.
|
|
11
|
+
*
|
|
12
|
+
* Returns [push, event] where:
|
|
13
|
+
* - `push(value)` sends a value to all current subscribers
|
|
14
|
+
* - `event` is a subscribable Event stream
|
|
15
|
+
*/
|
|
16
|
+
export declare const createAdapter: <A, E = never>() => [push: (value: A) => void, event: Event<A, E>];
|
|
17
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAyB,MAAM,YAAY,CAAC;AAG3E;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,GAAG,KAAK,OAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAuB3F,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsyncIterator integration.
|
|
3
|
+
*
|
|
4
|
+
* Bridges between Event streams and the AsyncIterator protocol,
|
|
5
|
+
* providing natural backpressure via pull-based async iteration.
|
|
6
|
+
*/
|
|
7
|
+
import type { Disposable, Event, Scheduler } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Convert an Event to an AsyncIterableIterator.
|
|
10
|
+
*
|
|
11
|
+
* Backpressure: the source pushes into a buffer. The consumer pulls
|
|
12
|
+
* via `next()`. If the consumer is slower than the producer, values
|
|
13
|
+
* buffer in memory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const toAsyncIterator: <A, E>(event: Event<A, E>, scheduler: Scheduler) => AsyncIterableIterator<A> & Disposable;
|
|
16
|
+
/**
|
|
17
|
+
* Create an Event from an AsyncIterable.
|
|
18
|
+
*
|
|
19
|
+
* The async iterable is pulled eagerly — each value is pushed
|
|
20
|
+
* to subscribers as soon as it's available.
|
|
21
|
+
*/
|
|
22
|
+
export declare const fromAsyncIterable: <A>(iterable: AsyncIterable<A>) => Event<A, never>;
|
|
23
|
+
//# sourceMappingURL=asyncIterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncIterator.d.ts","sourceRoot":"","sources":["../src/asyncIterator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAG3E;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAClC,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,WAAW,SAAS,KACnB,qBAAqB,CAAC,CAAC,CAAC,GAAG,UAqF7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,UAAU,aAAa,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,KAAK,CA2B5E,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavior constructors and combinators.
|
|
3
|
+
*
|
|
4
|
+
* A Behavior is a continuous time-varying value: Time → A.
|
|
5
|
+
* These are created with constructors, transformed with Functor/Applicative
|
|
6
|
+
* operations, and bridged with Events via stepper/sample/snapshot.
|
|
7
|
+
*/
|
|
8
|
+
import type { Behavior, Disposable, Duration, Event, Scheduler, Time } from "aeon-types";
|
|
9
|
+
import { sampleBehavior } from "./internal/behavior.js";
|
|
10
|
+
/**
|
|
11
|
+
* A Behavior that always holds the same value.
|
|
12
|
+
*
|
|
13
|
+
* Denotation: `t => value`
|
|
14
|
+
*/
|
|
15
|
+
export declare const constantB: <A>(value: A) => Behavior<A, never>;
|
|
16
|
+
/**
|
|
17
|
+
* A Behavior defined by an arbitrary function of time.
|
|
18
|
+
*
|
|
19
|
+
* Denotation: `f` itself.
|
|
20
|
+
*/
|
|
21
|
+
export declare const fromFunction: <A>(f: (time: Time) => A) => Behavior<A, never>;
|
|
22
|
+
/**
|
|
23
|
+
* The identity Behavior — its value is the current time.
|
|
24
|
+
*
|
|
25
|
+
* Denotation: `t => t`
|
|
26
|
+
*/
|
|
27
|
+
export declare const time: Behavior<Time, never>;
|
|
28
|
+
/**
|
|
29
|
+
* Alias for constantB — the pure/of for Behavior's Applicative.
|
|
30
|
+
*/
|
|
31
|
+
export declare const pureB: <A>(value: A) => Behavior<A, never>;
|
|
32
|
+
/**
|
|
33
|
+
* Transform the value of a Behavior.
|
|
34
|
+
*
|
|
35
|
+
* Denotation: `mapB(f, b) = t => f(b(t))`
|
|
36
|
+
*/
|
|
37
|
+
export declare const mapB: <A, B, E>(f: (a: A) => B, behavior: Behavior<A, E>) => Behavior<B, E>;
|
|
38
|
+
/**
|
|
39
|
+
* Lift a binary function over two Behaviors.
|
|
40
|
+
*
|
|
41
|
+
* Denotation: `liftA2B(f, ba, bb) = t => f(ba(t), bb(t))`
|
|
42
|
+
*/
|
|
43
|
+
export declare const liftA2B: <A1, A2, B, E>(f: (a1: A1, a2: A2) => B, ba: Behavior<A1, E>, bb: Behavior<A2, E>) => Behavior<B, E>;
|
|
44
|
+
/**
|
|
45
|
+
* Lift a ternary function over three Behaviors.
|
|
46
|
+
*
|
|
47
|
+
* Denotation: `liftA3B(f, ba, bb, bc) = t => f(ba(t), bb(t), bc(t))`
|
|
48
|
+
*/
|
|
49
|
+
export declare const liftA3B: <A1, A2, A3, B, E>(f: (a1: A1, a2: A2, a3: A3) => B, ba: Behavior<A1, E>, bb: Behavior<A2, E>, bc: Behavior<A3, E>) => Behavior<B, E>;
|
|
50
|
+
/**
|
|
51
|
+
* Lift a quaternary function over four Behaviors.
|
|
52
|
+
*
|
|
53
|
+
* Denotation: `liftA4B(f, ba, bb, bc, bd) = t => f(ba(t), bb(t), bc(t), bd(t))`
|
|
54
|
+
*/
|
|
55
|
+
export declare const liftA4B: <A1, A2, A3, A4, B, E>(f: (a1: A1, a2: A2, a3: A3, a4: A4) => B, ba: Behavior<A1, E>, bb: Behavior<A2, E>, bc: Behavior<A3, E>, bd: Behavior<A4, E>) => Behavior<B, E>;
|
|
56
|
+
/**
|
|
57
|
+
* Lift a quinary function over five Behaviors.
|
|
58
|
+
*
|
|
59
|
+
* Denotation: `liftA5B(f, ba, bb, bc, bd, be) = t => f(ba(t), bb(t), bc(t), bd(t), be(t))`
|
|
60
|
+
*/
|
|
61
|
+
export declare const liftA5B: <A1, A2, A3, A4, A5, B, E>(f: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => B, ba: Behavior<A1, E>, bb: Behavior<A2, E>, bc: Behavior<A3, E>, bd: Behavior<A4, E>, be: Behavior<A5, E>) => Behavior<B, E>;
|
|
62
|
+
/**
|
|
63
|
+
* Create a Behavior that holds the latest value from an Event.
|
|
64
|
+
*
|
|
65
|
+
* Denotation: `stepper(init, e) = t => latestValue(e, t) ?? init`
|
|
66
|
+
*
|
|
67
|
+
* This is the primary push→pull bridge. The returned behavior is
|
|
68
|
+
* push-updated when the event fires, and pull-sampled when read.
|
|
69
|
+
*
|
|
70
|
+
* IMPORTANT: The caller must provide a scheduler to subscribe to the event.
|
|
71
|
+
* Returns [Behavior, Disposable] — the disposable unsubscribes from the event.
|
|
72
|
+
*/
|
|
73
|
+
export declare const stepper: <A, E>(initial: A, event: Event<A, E>, scheduler: Scheduler) => [Behavior<A, E>, Disposable];
|
|
74
|
+
/**
|
|
75
|
+
* Create a Behavior that accumulates event values with a fold function.
|
|
76
|
+
*
|
|
77
|
+
* Denotation: `accumB(f, init, e) = t => foldl f init [v | (t', v) ∈ e, t' <= t]`
|
|
78
|
+
*
|
|
79
|
+
* Like `stepper` but applies a reducer to each event instead of replacing
|
|
80
|
+
* the held value. Equivalent to `stepper(init, scan(f, init, e))` but
|
|
81
|
+
* without an intermediate Event allocation.
|
|
82
|
+
*/
|
|
83
|
+
export declare const accumB: <A, B, E>(f: (acc: B, a: A) => B, initial: B, event: Event<A, E>, scheduler: Scheduler) => [Behavior<B, E>, Disposable];
|
|
84
|
+
/**
|
|
85
|
+
* Sample a Behavior whenever a sampler Event fires.
|
|
86
|
+
*
|
|
87
|
+
* Denotation: `sample(b, sampler) = [(t, b(t)) | (t, _) ∈ sampler]`
|
|
88
|
+
*/
|
|
89
|
+
export declare const sample: <A, B, E>(behavior: Behavior<A, E>, sampler: Event<B, E>) => Event<A, E>;
|
|
90
|
+
/**
|
|
91
|
+
* Snapshot: sample a Behavior and combine with the Event value.
|
|
92
|
+
*
|
|
93
|
+
* Denotation: `snapshot(f, b, e) = [(t, f(b(t), v)) | (t, v) ∈ e]`
|
|
94
|
+
*/
|
|
95
|
+
export declare const snapshot: <A, B, C, E>(f: (a: A, b: B) => C, behavior: Behavior<A, E>, event: Event<B, E>) => Event<C, E>;
|
|
96
|
+
/**
|
|
97
|
+
* Dynamic Behavior switching.
|
|
98
|
+
*
|
|
99
|
+
* Holds `initial` until the event fires, then switches to the
|
|
100
|
+
* Behavior carried by each event occurrence.
|
|
101
|
+
*
|
|
102
|
+
* Denotation: holds the most recently received Behavior; samples it.
|
|
103
|
+
*/
|
|
104
|
+
export declare const switcher: <A, E>(initial: Behavior<A, E>, event: Event<Behavior<A, E>, E>, scheduler: Scheduler) => [Behavior<A, E>, Disposable];
|
|
105
|
+
/**
|
|
106
|
+
* Flatten a Behavior of Behaviors — the Monad join for Behaviors.
|
|
107
|
+
*
|
|
108
|
+
* Denotation: `switchB(bb) = t => bb(t)(t)`
|
|
109
|
+
*
|
|
110
|
+
* At time `t`, samples the outer behavior to get the inner behavior,
|
|
111
|
+
* then samples the inner behavior at the same time. This is inherently
|
|
112
|
+
* non-cacheable (the inner behavior can change at any time).
|
|
113
|
+
*/
|
|
114
|
+
export declare const switchB: <A, E>(bb: Behavior<Behavior<A, E>, E>) => Behavior<A, E>;
|
|
115
|
+
/**
|
|
116
|
+
* Numerical integration of a Behavior over time.
|
|
117
|
+
*
|
|
118
|
+
* Denotation: `integral(b, dt) ≈ t => ∫₀ᵗ b(s) ds`
|
|
119
|
+
*
|
|
120
|
+
* Uses the trapezoidal rule with step size `dt`. The consumer's sampling
|
|
121
|
+
* rate and the integration step size are decoupled — the integrator
|
|
122
|
+
* subdivides [0, t] into steps of size `dt` regardless of when sampling
|
|
123
|
+
* occurs.
|
|
124
|
+
*/
|
|
125
|
+
export declare const integral: (behavior: Behavior<number, never>, dt: Duration) => Behavior<number, never>;
|
|
126
|
+
/**
|
|
127
|
+
* Numerical differentiation of a Behavior over time.
|
|
128
|
+
*
|
|
129
|
+
* Denotation: `derivative(b, dt) ≈ t => db/dt(t)`
|
|
130
|
+
*
|
|
131
|
+
* Uses the backward finite difference: `(b(t) - b(t - dt)) / dt`.
|
|
132
|
+
* At `t = 0`, returns 0 (no history). For `t < dt`, uses the
|
|
133
|
+
* available interval `[0, t]`.
|
|
134
|
+
*/
|
|
135
|
+
export declare const derivative: (behavior: Behavior<number, never>, dt: Duration) => Behavior<number, never>;
|
|
136
|
+
/**
|
|
137
|
+
* Read the current value of a Behavior at a given time.
|
|
138
|
+
*/
|
|
139
|
+
export { sampleBehavior as readBehavior };
|
|
140
|
+
//# sourceMappingURL=behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behavior.d.ts","sourceRoot":"","sources":["../src/behavior.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAQ,IAAI,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EAIL,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAKhC;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,CACZ,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,KAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,CAC/B,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAgC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,KAAK,GArBQ,CAAC,SAAS,CAAC,KAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,CAqB3B,CAAC;AAI/B;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,QAAQ,CAAC,CAAC,EAA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AC;AAEF;;GAEG;AACH,OAAO,EAAE,cAAc,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate combinators: count, every, elementAt.
|
|
3
|
+
*
|
|
4
|
+
* Simple stream aggregation operators that can be composed from
|
|
5
|
+
* primitives but are common enough to justify named combinators.
|
|
6
|
+
*/
|
|
7
|
+
import type { Event } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Emit the total number of values when the stream ends.
|
|
10
|
+
*
|
|
11
|
+
* Denotation: `count(e) = [(t_end, |e|)]`
|
|
12
|
+
*/
|
|
13
|
+
export declare const count: <A, E>(event: Event<A, E>) => Event<number, E>;
|
|
14
|
+
/**
|
|
15
|
+
* Emit `true` when the stream ends if all values matched the predicate,
|
|
16
|
+
* or `false` as soon as one fails.
|
|
17
|
+
*
|
|
18
|
+
* Denotation: `all(p, e) = [(t, ∀v ∈ e. p(v))]`
|
|
19
|
+
*/
|
|
20
|
+
export declare const all: <A, E>(predicate: (a: A) => boolean, event: Event<A, E>) => Event<boolean, E>;
|
|
21
|
+
/**
|
|
22
|
+
* Emit only the nth value (0-indexed), then end.
|
|
23
|
+
*
|
|
24
|
+
* Denotation: `elementAt(n, e) = [e[n]]` if it exists, empty otherwise.
|
|
25
|
+
*/
|
|
26
|
+
export declare const elementAt: <A, E>(n: number, event: Event<A, E>) => Event<A, E>;
|
|
27
|
+
//# sourceMappingURL=aggregate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/combinators/aggregate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AA0CnF;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CACd,CAAC;AA6CnD;;;;;GAKG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAClC,CAAC;AAoD5D;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CACjB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* attach combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `attach(f, sampled, sampler)` emits
|
|
5
|
+
* `f(latestA, b)` whenever `sampler` fires, using the latest
|
|
6
|
+
* value from `sampled`. Only emits after `sampled` has produced
|
|
7
|
+
* at least one value.
|
|
8
|
+
*
|
|
9
|
+
* Uses monomorphic Sink/Source classes for V8 hidden class stability.
|
|
10
|
+
*/
|
|
11
|
+
import type { Event } from "aeon-types";
|
|
12
|
+
/**
|
|
13
|
+
* Combine the latest value from one stream with each emission of another.
|
|
14
|
+
*
|
|
15
|
+
* Emits `f(latestA, b)` each time `sampler` fires, using the most recent
|
|
16
|
+
* value from `sampled`. Only emits after `sampled` has produced at least one value.
|
|
17
|
+
*
|
|
18
|
+
* The output ends when `sampler` ends. Errors from either source propagate.
|
|
19
|
+
*/
|
|
20
|
+
export declare const attach: <A, B, C, E>(f: (a: A, b: B) => C, sampled: Event<A, E>, sampler: Event<B, E>) => Event<C, E>;
|
|
21
|
+
//# sourceMappingURL=attach.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../../src/combinators/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAkFnF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EACpB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KACnB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAgF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chain combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `chain(f, e) = concat(map(f, e))` — each inner stream
|
|
5
|
+
* runs to completion before the next begins.
|
|
6
|
+
*
|
|
7
|
+
* Uses monomorphic Sink/Source classes for V8 hidden class stability.
|
|
8
|
+
*/
|
|
9
|
+
import type { Event } from "aeon-types";
|
|
10
|
+
/**
|
|
11
|
+
* Sequentially flatMap: for each value, create an inner Event and
|
|
12
|
+
* concatenate the results.
|
|
13
|
+
*
|
|
14
|
+
* Denotation: `chain(f, e) = concat [f(v) | (t, v) ∈ e]`
|
|
15
|
+
*/
|
|
16
|
+
export declare const chain: <A, B, E>(f: (a: A) => Event<B, E>, event: Event<A, E>) => Event<B, E>;
|
|
17
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/combinators/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAiHnF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CACnC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* combine and zip combinators.
|
|
3
|
+
*
|
|
4
|
+
* combine: emits whenever either source emits, using the latest value from each.
|
|
5
|
+
* zip: emits pairwise — only when both sources have emitted a new value.
|
|
6
|
+
*
|
|
7
|
+
* Uses monomorphic Sink/Source classes for V8 hidden class stability.
|
|
8
|
+
*/
|
|
9
|
+
import type { Event } from "aeon-types";
|
|
10
|
+
/**
|
|
11
|
+
* Combine two event streams using a function, emitting whenever either source emits.
|
|
12
|
+
*
|
|
13
|
+
* Denotation: emits f(latestA, latestB) at each time where either A or B fires,
|
|
14
|
+
* once both have produced at least one value.
|
|
15
|
+
*/
|
|
16
|
+
export declare const combine: <A, B, C, E>(f: (a: A, b: B) => C, ea: Event<A, E>, eb: Event<B, E>) => Event<C, E>;
|
|
17
|
+
/**
|
|
18
|
+
* Zip two event streams pairwise.
|
|
19
|
+
*
|
|
20
|
+
* Denotation: `zip(ea, eb) = [(t, [a, b]) | (ta, a) ∈ ea, (tb, b) ∈ eb]`
|
|
21
|
+
* where pairs are consumed in order, t = max(ta, tb).
|
|
22
|
+
*/
|
|
23
|
+
export declare const zip: <A, B, E>(ea: Event<A, E>, eb: Event<B, E>) => Event<[A, B], E>;
|
|
24
|
+
//# sourceMappingURL=combine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../../src/combinators/combine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAsGnF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAChC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EACpB,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACf,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KACd,KAAK,CAAC,CAAC,EAAE,CAAC,CAAuE,CAAC;AA6FrF;;;;;GAKG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAClB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cons combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `cons(value, e) = [(t₀, value)] ++ e`
|
|
5
|
+
* Prepends a synchronous initial value before the first event.
|
|
6
|
+
*/
|
|
7
|
+
import type { Event } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Prepend an initial value before the first event.
|
|
10
|
+
*
|
|
11
|
+
* Denotation: `cons(value, e) = [(t₀, value)] ++ e`
|
|
12
|
+
*/
|
|
13
|
+
export declare const cons: <A, E>(value: A, event: Event<A, E>) => Event<A, E>;
|
|
14
|
+
//# sourceMappingURL=cons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cons.d.ts","sourceRoot":"","sources":["../../src/combinators/cons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAkBnF;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CACZ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* constant combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `constant(b, e) = [(t, b) | (t, _) ∈ e]`
|
|
5
|
+
*/
|
|
6
|
+
import type { Event } from "aeon-types";
|
|
7
|
+
/**
|
|
8
|
+
* Replace every value in the stream with a constant.
|
|
9
|
+
*
|
|
10
|
+
* Denotation: `constant(b, e) = map(_ => b, e)`
|
|
11
|
+
*/
|
|
12
|
+
export declare const constant: <A, B, E>(value: B, event: Event<A, E>) => Event<B, E>;
|
|
13
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/combinators/constant.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAClD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dedupe combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: suppress consecutive duplicate values.
|
|
5
|
+
* `dedupe(eq, e) = [(t, v) | (t, v) ∈ e, v ≠ prev]`
|
|
6
|
+
* where `prev` is the most recently emitted value.
|
|
7
|
+
*/
|
|
8
|
+
import type { Event } from "aeon-types";
|
|
9
|
+
/**
|
|
10
|
+
* Suppress consecutive duplicate values.
|
|
11
|
+
*
|
|
12
|
+
* Denotation: emits a value only when it differs from the previous
|
|
13
|
+
* emission, according to the provided equality function (defaults to `===`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const dedupe: <A, E>(event: Event<A, E>, eq?: (a: A, b: A) => boolean) => Event<A, E>;
|
|
16
|
+
//# sourceMappingURL=dedupe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedupe.d.ts","sourceRoot":"","sources":["../../src/combinators/dedupe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAwCnF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EACzB,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,KAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,KACtC,KAAK,CAAC,CAAC,EAAE,CAAC,CAA0D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ensure combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: run a side-effect function when the stream ends or errors.
|
|
5
|
+
* The cleanup runs exactly once.
|
|
6
|
+
*/
|
|
7
|
+
import type { Event } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Run a cleanup function when the stream ends, errors, or is disposed.
|
|
10
|
+
* The cleanup runs exactly once regardless of which termination path fires.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ensure: <A, E>(cleanup: () => void, event: Event<A, E>) => Event<A, E>;
|
|
13
|
+
//# sourceMappingURL=ensure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure.d.ts","sourceRoot":"","sources":["../../src/combinators/ensure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAyDnF;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,SAAS,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CACrB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling combinators with typed error channel.
|
|
3
|
+
*
|
|
4
|
+
* The E type parameter transforms through these operations — this is
|
|
5
|
+
* the key advantage over untyped error handling.
|
|
6
|
+
*
|
|
7
|
+
* Uses monomorphic Sink/Source classes for V8 hidden class stability.
|
|
8
|
+
*/
|
|
9
|
+
import type { Event } from "aeon-types";
|
|
10
|
+
/**
|
|
11
|
+
* Recover from errors by switching to a new Event stream.
|
|
12
|
+
* The error type CHANGES from E1 to E2.
|
|
13
|
+
*
|
|
14
|
+
* Denotation: if the stream errors with `e`, continue with `handler(e)`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const catchError: <A, E1, E2>(handler: (err: E1) => Event<A, E2>, event: Event<A, E1>) => Event<A, E2>;
|
|
17
|
+
/**
|
|
18
|
+
* Transform the error value without changing the stream structure.
|
|
19
|
+
*
|
|
20
|
+
* Denotation: `mapError(f, e)` — the error, if any, is replaced by `f(err)`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const mapError: <A, E1, E2>(f: (err: E1) => E2, event: Event<A, E1>) => Event<A, E2>;
|
|
23
|
+
/**
|
|
24
|
+
* An Event that immediately errors with the given value.
|
|
25
|
+
*
|
|
26
|
+
* Denotation: `Error(err)` — a failed event sequence.
|
|
27
|
+
*/
|
|
28
|
+
export declare const throwError: <A, E>(err: E) => Event<A, E>;
|
|
29
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/combinators/error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAuDnF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAClC,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAClC,OAAO,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAClB,KAAK,CAAC,CAAC,EAAE,EAAE,CAA8D,CAAC;AAyC7E;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,EAAE,CACjC,CAAC;AAiBzD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAA4C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* exhaustMap combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: while an inner stream is active, ignore new outer values.
|
|
5
|
+
* The counterpart to switchLatest (which cancels) and mergeMap (which
|
|
6
|
+
* runs all concurrently).
|
|
7
|
+
*/
|
|
8
|
+
import type { Event } from "aeon-types";
|
|
9
|
+
/**
|
|
10
|
+
* Map each outer value to an inner Event, ignoring new outer values
|
|
11
|
+
* while the current inner is still active.
|
|
12
|
+
*
|
|
13
|
+
* Denotation: projects outer values to inner streams, but drops
|
|
14
|
+
* projections that arrive while an inner stream is running.
|
|
15
|
+
*/
|
|
16
|
+
export declare const exhaustMap: <A, B, E>(f: (a: A) => Event<B, E>, event: Event<A, E>) => Event<B, E>;
|
|
17
|
+
//# sourceMappingURL=exhaustMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exhaustMap.d.ts","sourceRoot":"","sources":["../../src/combinators/exhaustMap.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AA0FnF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CACnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* filter combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `filter(p, e) = [(t, v) | (t, v) ∈ e, p(v)]`
|
|
5
|
+
*
|
|
6
|
+
* Uses pipeline fusion: filter∘filter is collapsed into a single filter
|
|
7
|
+
* with conjoined predicates. filter∘map becomes a mapFilter node.
|
|
8
|
+
*/
|
|
9
|
+
import type { Event } from "aeon-types";
|
|
10
|
+
/**
|
|
11
|
+
* Keep only values that satisfy the predicate.
|
|
12
|
+
*
|
|
13
|
+
* Denotation: `filter(p, e) = [(t, v) | (t, v) ∈ e, p(v)]`
|
|
14
|
+
*/
|
|
15
|
+
export declare const filter: <A, E>(predicate: (a: A) => boolean, event: Event<A, E>) => Event<A, E>;
|
|
16
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/combinators/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAC3D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* first and last combinators.
|
|
3
|
+
*
|
|
4
|
+
* first: emit only the first value (optionally matching a predicate), then end.
|
|
5
|
+
* last: emit only the final value (optionally matching a predicate) on end.
|
|
6
|
+
*/
|
|
7
|
+
import type { Event } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Emit only the first value, then end.
|
|
10
|
+
* With a predicate: emit the first value matching the predicate.
|
|
11
|
+
*
|
|
12
|
+
* Denotation: `first(e) = take(1, e)`
|
|
13
|
+
* `first(p, e) = take(1, filter(p, e))`
|
|
14
|
+
*/
|
|
15
|
+
export declare const first: <A, E>(event: Event<A, E>, predicate?: (a: A) => boolean) => Event<A, E>;
|
|
16
|
+
/**
|
|
17
|
+
* Emit only the final value when the stream ends.
|
|
18
|
+
* With a predicate: emit the last value matching the predicate.
|
|
19
|
+
*
|
|
20
|
+
* Denotation: `last(e) = let vs = values(e) in [vs[|vs|-1]]`
|
|
21
|
+
*/
|
|
22
|
+
export declare const last: <A, E>(event: Event<A, E>, predicate?: (a: A) => boolean) => Event<A, E>;
|
|
23
|
+
//# sourceMappingURL=firstLast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstLast.d.ts","sourceRoot":"","sources":["../../src/combinators/firstLast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAuDnF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAC7B,CAAC;AA2C9D;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAC7B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* forkJoin combinator.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: wait for all streams to complete, emit an array
|
|
5
|
+
* of their final values. If any stream completes without emitting,
|
|
6
|
+
* the result completes without emitting.
|
|
7
|
+
*/
|
|
8
|
+
import type { Event } from "aeon-types";
|
|
9
|
+
/**
|
|
10
|
+
* Wait for all streams to complete, then emit an array of their final values.
|
|
11
|
+
* If any stream completes without emitting, the result completes empty.
|
|
12
|
+
*/
|
|
13
|
+
export declare const forkJoin: <A, E>(...events: Event<A, E>[]) => Event<A[], E>;
|
|
14
|
+
//# sourceMappingURL=forkJoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forkJoin.d.ts","sourceRoot":"","sources":["../../src/combinators/forkJoin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AA6EnF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAG,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CACZ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fromPromise constructor.
|
|
3
|
+
*
|
|
4
|
+
* Denotation: `fromPromise(p) = [(t_resolve, value)]` or `Error(rejection)`
|
|
5
|
+
* where `t_resolve` is the time at which the promise settles.
|
|
6
|
+
*/
|
|
7
|
+
import type { Event } from "aeon-types";
|
|
8
|
+
/**
|
|
9
|
+
* Create an Event from a Promise.
|
|
10
|
+
*
|
|
11
|
+
* The event emits the resolved value at the time the promise settles,
|
|
12
|
+
* then ends. If the promise rejects, the event errors.
|
|
13
|
+
*
|
|
14
|
+
* Denotation: `[(t_resolve, value)]` or `Error(rejection)`
|
|
15
|
+
*/
|
|
16
|
+
export declare const fromPromise: <A>(promise: Promise<A>) => Event<A, unknown>;
|
|
17
|
+
//# sourceMappingURL=fromPromise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromPromise.d.ts","sourceRoot":"","sources":["../../src/combinators/fromPromise.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,KAAK,EAAiC,MAAM,YAAY,CAAC;AAoCnF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,OAAO,CACvB,CAAC"}
|