@graphrefly/ts 0.0.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/LICENSE +21 -0
- package/dist/adapters/index.cjs +9015 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +678 -0
- package/dist/adapters/index.d.ts +678 -0
- package/dist/adapters/index.js +2894 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/observe-storage.cjs +260 -0
- package/dist/adapters/observe-storage.cjs.map +1 -0
- package/dist/adapters/observe-storage.d.cts +77 -0
- package/dist/adapters/observe-storage.d.ts +77 -0
- package/dist/adapters/observe-storage.js +161 -0
- package/dist/adapters/observe-storage.js.map +1 -0
- package/dist/append-log-DisvEReb.d.cts +189 -0
- package/dist/append-log-DzKMmjxx.d.ts +189 -0
- package/dist/chunk-2ILL7HQI.js +1189 -0
- package/dist/chunk-2ILL7HQI.js.map +1 -0
- package/dist/chunk-4VLAQHZI.js +330 -0
- package/dist/chunk-4VLAQHZI.js.map +1 -0
- package/dist/chunk-6PHB5CJS.js +229 -0
- package/dist/chunk-6PHB5CJS.js.map +1 -0
- package/dist/chunk-COHO25CZ.js +2449 -0
- package/dist/chunk-COHO25CZ.js.map +1 -0
- package/dist/chunk-D6BG7U6A.js +161 -0
- package/dist/chunk-D6BG7U6A.js.map +1 -0
- package/dist/chunk-DJC4CHLQ.js +818 -0
- package/dist/chunk-DJC4CHLQ.js.map +1 -0
- package/dist/chunk-DK554R7P.js +67 -0
- package/dist/chunk-DK554R7P.js.map +1 -0
- package/dist/chunk-DKP56CSW.js +322 -0
- package/dist/chunk-DKP56CSW.js.map +1 -0
- package/dist/chunk-G4M3NHRJ.js +688 -0
- package/dist/chunk-G4M3NHRJ.js.map +1 -0
- package/dist/chunk-GAJW5I5P.js +1 -0
- package/dist/chunk-GAJW5I5P.js.map +1 -0
- package/dist/chunk-GDL26N2T.js +282 -0
- package/dist/chunk-GDL26N2T.js.map +1 -0
- package/dist/chunk-GTPCOEOZ.js +741 -0
- package/dist/chunk-GTPCOEOZ.js.map +1 -0
- package/dist/chunk-H2HTHFVN.js +1 -0
- package/dist/chunk-H2HTHFVN.js.map +1 -0
- package/dist/chunk-HDRL4VQQ.js +218 -0
- package/dist/chunk-HDRL4VQQ.js.map +1 -0
- package/dist/chunk-I3IHOHCJ.js +2267 -0
- package/dist/chunk-I3IHOHCJ.js.map +1 -0
- package/dist/chunk-JIMUDQN3.js +965 -0
- package/dist/chunk-JIMUDQN3.js.map +1 -0
- package/dist/chunk-JR4IKCR2.js +462 -0
- package/dist/chunk-JR4IKCR2.js.map +1 -0
- package/dist/chunk-K3FXTC3I.js +165 -0
- package/dist/chunk-K3FXTC3I.js.map +1 -0
- package/dist/chunk-OOEN33FB.js +65 -0
- package/dist/chunk-OOEN33FB.js.map +1 -0
- package/dist/chunk-PKVBHGBM.js +554 -0
- package/dist/chunk-PKVBHGBM.js.map +1 -0
- package/dist/chunk-RIIOUTGM.js +1857 -0
- package/dist/chunk-RIIOUTGM.js.map +1 -0
- package/dist/chunk-SCRFRCGR.js +33 -0
- package/dist/chunk-SCRFRCGR.js.map +1 -0
- package/dist/chunk-SWTLEQL6.js +53 -0
- package/dist/chunk-SWTLEQL6.js.map +1 -0
- package/dist/chunk-SZAETNNA.js +1 -0
- package/dist/chunk-SZAETNNA.js.map +1 -0
- package/dist/chunk-TEW47IVR.js +49 -0
- package/dist/chunk-TEW47IVR.js.map +1 -0
- package/dist/chunk-Y3ZLRGHC.js +1482 -0
- package/dist/chunk-Y3ZLRGHC.js.map +1 -0
- package/dist/chunk-Z2ANQ6JW.js +149 -0
- package/dist/chunk-Z2ANQ6JW.js.map +1 -0
- package/dist/codec-BB7p8fJc.d.cts +38 -0
- package/dist/codec-BB7p8fJc.d.ts +38 -0
- package/dist/composition/index.cjs +2505 -0
- package/dist/composition/index.cjs.map +1 -0
- package/dist/composition/index.d.cts +95 -0
- package/dist/composition/index.d.ts +95 -0
- package/dist/composition/index.js +19 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/core/index.cjs +2475 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +25 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.js +74 -0
- package/dist/core/index.js.map +1 -0
- package/dist/cqrs/index.cjs +595 -0
- package/dist/cqrs/index.cjs.map +1 -0
- package/dist/cqrs/index.d.cts +200 -0
- package/dist/cqrs/index.d.ts +200 -0
- package/dist/cqrs/index.js +557 -0
- package/dist/cqrs/index.js.map +1 -0
- package/dist/data-structures/index.cjs +4277 -0
- package/dist/data-structures/index.cjs.map +1 -0
- package/dist/data-structures/index.d.cts +22 -0
- package/dist/data-structures/index.d.ts +22 -0
- package/dist/data-structures/index.js +31 -0
- package/dist/data-structures/index.js.map +1 -0
- package/dist/describe-BZb7AS2y.d.ts +57 -0
- package/dist/describe-Ciu8SUnN.d.cts +57 -0
- package/dist/graph/index.cjs +7832 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +251 -0
- package/dist/graph/index.d.ts +251 -0
- package/dist/graph/index.js +131 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph-DfdF9zy4.d.ts +666 -0
- package/dist/graph-s23RbbFO.d.cts +666 -0
- package/dist/index-CAEmLCYF.d.cts +166 -0
- package/dist/index-SnzZu3x7.d.ts +166 -0
- package/dist/index.cjs +15409 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-BZqrGGm1.d.cts +55 -0
- package/dist/messages-BZqrGGm1.d.ts +55 -0
- package/dist/messaging/index.cjs +818 -0
- package/dist/messaging/index.cjs.map +1 -0
- package/dist/messaging/index.d.cts +235 -0
- package/dist/messaging/index.d.ts +235 -0
- package/dist/messaging/index.js +767 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
- package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
- package/dist/operators/index.cjs +3774 -0
- package/dist/operators/index.cjs.map +1 -0
- package/dist/operators/index.d.cts +308 -0
- package/dist/operators/index.d.ts +308 -0
- package/dist/operators/index.js +112 -0
- package/dist/operators/index.js.map +1 -0
- package/dist/orchestration/index.cjs +3541 -0
- package/dist/orchestration/index.cjs.map +1 -0
- package/dist/orchestration/index.d.cts +302 -0
- package/dist/orchestration/index.d.ts +302 -0
- package/dist/orchestration/index.js +1004 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/patterns/index.cjs +1045 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.cts +39 -0
- package/dist/patterns/index.d.ts +39 -0
- package/dist/patterns/index.js +33 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
- package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
- package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
- package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
- package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
- package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
- package/dist/read-through-B1CYPfq_.d.cts +82 -0
- package/dist/read-through-DwyJhGs1.d.ts +82 -0
- package/dist/render/index.cjs +250 -0
- package/dist/render/index.cjs.map +1 -0
- package/dist/render/index.d.cts +58 -0
- package/dist/render/index.d.ts +58 -0
- package/dist/render/index.js +20 -0
- package/dist/render/index.js.map +1 -0
- package/dist/resilience-Dig3Q7n0.d.cts +45 -0
- package/dist/resilience-Dig3Q7n0.d.ts +45 -0
- package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
- package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
- package/dist/solutions/index.cjs +3249 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +520 -0
- package/dist/solutions/index.d.ts +520 -0
- package/dist/solutions/index.js +31 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/sources/browser.cjs +3095 -0
- package/dist/sources/browser.cjs.map +1 -0
- package/dist/sources/browser.d.cts +39 -0
- package/dist/sources/browser.d.ts +39 -0
- package/dist/sources/browser.js +137 -0
- package/dist/sources/browser.js.map +1 -0
- package/dist/sources/index.cjs +3021 -0
- package/dist/sources/index.cjs.map +1 -0
- package/dist/sources/index.d.cts +7 -0
- package/dist/sources/index.d.ts +7 -0
- package/dist/sources/index.js +63 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/node.cjs +675 -0
- package/dist/sources/node.cjs.map +1 -0
- package/dist/sources/node.d.cts +109 -0
- package/dist/sources/node.d.ts +109 -0
- package/dist/sources/node.js +639 -0
- package/dist/sources/node.js.map +1 -0
- package/dist/storage/browser.cjs +777 -0
- package/dist/storage/browser.cjs.map +1 -0
- package/dist/storage/browser.d.cts +40 -0
- package/dist/storage/browser.d.ts +40 -0
- package/dist/storage/browser.js +275 -0
- package/dist/storage/browser.js.map +1 -0
- package/dist/storage/index.cjs +1989 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +92 -0
- package/dist/storage/index.d.ts +92 -0
- package/dist/storage/index.js +161 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/node.cjs +898 -0
- package/dist/storage/node.cjs.map +1 -0
- package/dist/storage/node.d.cts +66 -0
- package/dist/storage/node.d.ts +66 -0
- package/dist/storage/node.js +402 -0
- package/dist/storage/node.js.map +1 -0
- package/dist/testing/index.cjs +95 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +20 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-bNMSWKqF.d.cts +732 -0
- package/dist/types-h12mNYbq.d.ts +732 -0
- package/package.json +250 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { L as Operator } from '../graph-s23RbbFO.cjs';
|
|
2
|
+
export { D as DefineOpts, a as Definition, M as RestoreRegistryEntry, S as SettleOpts, U as TapObserver, $ as ValveOpts, a2 as catchError, a5 as define, a6 as distinctUntilChanged, a7 as elementAt, a8 as filter, aa as find, ab as first, ae as initNode, af as last, ag as map, ai as merge, ak as onFirstData, al as pairwise, am as reduce, an as rescue, ap as restoreRegistry, aq as scan, ar as settle, as as skip, au as take, aw as takeWhile, ax as tap, ay as tapFirst, aA as valve } from '../graph-s23RbbFO.cjs';
|
|
3
|
+
import { N as NodeInput } from '../index-CAEmLCYF.cjs';
|
|
4
|
+
import { N as Node } from '../types-bNMSWKqF.cjs';
|
|
5
|
+
import '../core/index.cjs';
|
|
6
|
+
import '../messages-BZqrGGm1.cjs';
|
|
7
|
+
import '../codec-BB7p8fJc.cjs';
|
|
8
|
+
import '../describe-Ciu8SUnN.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Multi-source combinators + notifier-driven operators (CSP-2.7 catalog re-derive, D40 / D45).
|
|
12
|
+
*
|
|
13
|
+
* Per-language sugar (D6/D24, never in parity). Each forms topology ONLY via DECLARED deps (D45) —
|
|
14
|
+
* the frozen pure-ts reference (D41) builds these as a producer that calls `subscribeOr` on each
|
|
15
|
+
* source INSIDE the fn body, which is the D45-banned describe island (an edge `describe` cannot
|
|
16
|
+
* show). Re-derived here as static-dep nodes with `partial:true` (fire on any dep, R-first-run-gate
|
|
17
|
+
* off) + `ctx.state` (queue / phase / winner) — so every edge is a real subscription `describe`
|
|
18
|
+
* shows truthfully (D3 / R-edges-derived). Multi-source completion / error reads
|
|
19
|
+
* `depTerminal(ctx, i)` (R-deps-terminal) via `completeWhenDepsComplete:false +
|
|
20
|
+
* terminalAsRealInput:true`.
|
|
21
|
+
*
|
|
22
|
+
* Under D49 (no equals-absorption) `combine` emits a fresh tuple on EVERY contributing wave (no
|
|
23
|
+
* substrate tuple-dedup; the pure-ts `equals` tuple comparator is gone) — pair with
|
|
24
|
+
* `distinctUntilChanged` for opt-in dedup. SENTINEL ("a dep has never delivered DATA") is detected
|
|
25
|
+
* via `depLatest(ctx, i) === undefined` (R-sentinel: `undefined` is the global sentinel, `null` is a valid
|
|
26
|
+
* value).
|
|
27
|
+
*
|
|
28
|
+
* NOT re-derived in this cut (flagged): the window family (`window`/`windowCount`/`windowTime`)
|
|
29
|
+
* emits `Node<Node<T>>` nested sub-streams — the frozen reference creates child nodes inside the fn
|
|
30
|
+
* body and pushes DATA into them imperatively, which is a describe island AND an open question for
|
|
31
|
+
* how an emitted live sub-stream appears in `describe` (D45/D51). Deferred to a design pass.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* combine (alias `combineLatest`): emit a tuple of every dep's latest value whenever ANY dep
|
|
36
|
+
* delivers, once ALL deps have delivered at least one value. `partial:true`; the all-delivered gate
|
|
37
|
+
* is `depLatest(ctx, i) !== undefined` per dep. Completes when ALL deps complete (default
|
|
38
|
+
* completeWhenDepsComplete); any dep ERROR propagates (default errorWhenDepsError). Emits a fresh
|
|
39
|
+
* tuple per wave (D49 — no dedup; compose `distinctUntilChanged` to suppress unchanged tuples).
|
|
40
|
+
*/
|
|
41
|
+
declare function combine<T extends readonly unknown[]>(): Operator<unknown, T>;
|
|
42
|
+
/** combineLatest: RxJS-named alias of {@link combine}. */
|
|
43
|
+
declare const combineLatest: typeof combine;
|
|
44
|
+
/**
|
|
45
|
+
* withLatestFrom: on each PRIMARY (dep 0) value, emit `[primary, latestSecondary]`; a secondary-only
|
|
46
|
+
* (dep 1) wave updates the cached secondary but emits nothing. Uses the DEFAULT first-run gate
|
|
47
|
+
* (`partial:false`), NOT partial — the frozen reference's Phase 10.5 W1 fix: with `partial:true` the
|
|
48
|
+
* primary's push-on-subscribe fires the fn BEFORE the secondary has delivered, so the initial pair
|
|
49
|
+
* is dropped. The gate holds the first run until BOTH deps settle, then fires once with both
|
|
50
|
+
* populated; subsequent waves are gate-free and fire on primary-alone. Completes when the PRIMARY
|
|
51
|
+
* completes (not the secondary) — `completeWhenDepsComplete:false + terminalAsRealInput:true` with a
|
|
52
|
+
* primary-terminal check; a secondary terminal is ignored (its last value persists).
|
|
53
|
+
*/
|
|
54
|
+
declare function withLatestFrom<A, B>(): Operator<unknown, readonly [A, B]>;
|
|
55
|
+
/**
|
|
56
|
+
* zip: combine one value from EACH dep, in lockstep, into a tuple — buffering per-dep queues until
|
|
57
|
+
* every dep has at least one queued value, then shifting one from each. `partial:true` +
|
|
58
|
+
* `ctx.state` queues. Completes as soon as ANY dep is terminal AND its queue is empty (no further
|
|
59
|
+
* tuple can form) — `completeWhenDepsComplete:false + terminalAsRealInput:true`. Any dep ERROR
|
|
60
|
+
* propagates (default errorWhenDepsError).
|
|
61
|
+
*/
|
|
62
|
+
declare function zip<T extends readonly unknown[]>(): Operator<unknown, T>;
|
|
63
|
+
/**
|
|
64
|
+
* concat: play ALL of dep 0, then ALL of dep 1. Dep-1 DATA arriving during phase 0 is buffered and
|
|
65
|
+
* flushed at the handoff (dep 0 COMPLETE). `partial:true` + `ctx.state` phase. Completes when dep 1
|
|
66
|
+
* completes (or when dep 0 completes and dep 1 already had). `completeWhenDepsComplete:false +
|
|
67
|
+
* terminalAsRealInput:true`; any dep ERROR propagates (default errorWhenDepsError).
|
|
68
|
+
*/
|
|
69
|
+
declare function concat<S>(): Operator<S, S>;
|
|
70
|
+
/**
|
|
71
|
+
* race: the FIRST dep to deliver DATA wins; thereafter only the winner's messages flow (losers are
|
|
72
|
+
* dropped, including their terminals). `partial:true` + `ctx.state` winner. `errorWhenDepsError:false`
|
|
73
|
+
* (a LOSER's error must not error the race — only the winner's) + `completeWhenDepsComplete:false +
|
|
74
|
+
* terminalAsRealInput:true`. If every dep terminates before any DATA, COMPLETE.
|
|
75
|
+
*/
|
|
76
|
+
declare function race<S>(): Operator<S, S>;
|
|
77
|
+
/**
|
|
78
|
+
* buffer: accumulate dep 0 (source) DATA; flush the buffer as an array each time dep 1 (notifier)
|
|
79
|
+
* delivers DATA. `partial:true` + `ctx.state` buffer. On source COMPLETE, flush any remainder then
|
|
80
|
+
* COMPLETE (`completeWhenDepsComplete:false + terminalAsRealInput:true`; a notifier terminal is
|
|
81
|
+
* ignored). Source/notifier ERROR propagates (default errorWhenDepsError).
|
|
82
|
+
*/
|
|
83
|
+
declare function buffer<S>(): Operator<unknown, S[]>;
|
|
84
|
+
/**
|
|
85
|
+
* bufferCount: batch consecutive source DATA into arrays of length `count`; the remainder flushes on
|
|
86
|
+
* source COMPLETE. Single dep + `ctx.state` buffer + `completeWhenDepsComplete:false +
|
|
87
|
+
* terminalAsRealInput:true`.
|
|
88
|
+
*/
|
|
89
|
+
declare function bufferCount<S>(count: number): Operator<S, S[]>;
|
|
90
|
+
/**
|
|
91
|
+
* sample: emit the source's (dep 0) most recent value each time the notifier (dep 1) delivers DATA.
|
|
92
|
+
* `partial:true` + `ctx.state`. The notifier completing completes the operator; the source completing
|
|
93
|
+
* stops sampling (clears the held value); an ERROR from either terminates.
|
|
94
|
+
* `completeWhenDepsComplete:false + errorWhenDepsError:false + terminalAsRealInput:true` (manual
|
|
95
|
+
* terminal handling). No flush of the held value on source COMPLETE (RxJS sample semantics).
|
|
96
|
+
*/
|
|
97
|
+
declare function sample<S>(): Operator<unknown, S>;
|
|
98
|
+
/**
|
|
99
|
+
* takeUntil: forward dep 0 (source) DATA until dep 1 (notifier) delivers its first DATA, then
|
|
100
|
+
* COMPLETE. `partial:true` + `completeWhenDepsComplete:false + terminalAsRealInput:true`: a source
|
|
101
|
+
* COMPLETE forwards COMPLETE; a notifier DATA triggers COMPLETE. Source/notifier ERROR propagates
|
|
102
|
+
* (default errorWhenDepsError).
|
|
103
|
+
*/
|
|
104
|
+
declare function takeUntil<S>(): Operator<unknown, S>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Higher-order operators — switchMap / mergeMap / concatMap / exhaustMap / flatMap
|
|
108
|
+
* (D47 / R-rewire-deferred / CSP-2.7; per-language sugar, D6/D24, never in parity).
|
|
109
|
+
*
|
|
110
|
+
* Each projects every outer value to an INNER source and flattens the inners' emissions. The
|
|
111
|
+
* inner sources are wired as runtime DEPS via the deferred-self-rewire substrate affordance
|
|
112
|
+
* (`ctx.rewireNext`, D47) — NOT an internal subscribe (D45 bans that; it would create a describe
|
|
113
|
+
* island). Growing/shrinking the dep set is deferred to the committed wave boundary, so a fn
|
|
114
|
+
* never mutates its own topology mid-run (that is the D37 feedback-cycle ERROR). An inner that
|
|
115
|
+
* COMPLETEs is `unsubscribeDep`'d → its source `_deactivate`s + fires `onDeactivation`: that is the
|
|
116
|
+
* cancellation / abortInFlight basis (switchMap drops the superseded inner's WORK, not just its
|
|
117
|
+
* output; mergeMap bounds memory). Built on the bare `node` primitive via the {@link Operator}
|
|
118
|
+
* factory shape + the `g.initNode` funnel (D43), so the real factory name shows in describe.
|
|
119
|
+
*
|
|
120
|
+
* Lifecycle folding (D47/D81): completeWhenDepsComplete:false + terminalAsRealInput:true +
|
|
121
|
+
* errorWhenDepsError:false — the operator owns completion (emit COMPLETE only when the SOURCE is
|
|
122
|
+
* done AND no inner is live / pending), and observes source/inner ERROR so it can remove every live
|
|
123
|
+
* inner before emitting ERROR. Those removals drain after terminal via D62: terminal seals output,
|
|
124
|
+
* while helper-owned upstream work still sees unsubscribeDep->_deactivate->onDeactivation teardown.
|
|
125
|
+
*
|
|
126
|
+
* Alignment: each run issues REMOVES before ADDS so the per-node FIFO drain keeps the operator's
|
|
127
|
+
* tracked inner list aligned with the live dep order across the intermediate boundary waves (a
|
|
128
|
+
* removed dep is silent — no settle — and applies before any added dep's push-on-subscribe wave).
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/** Project an outer value to an inner source (a Node, Promise, (a)sync iterable, or scalar). */
|
|
132
|
+
type Project<TIn, TOut> = (value: TIn) => NodeInput<TOut>;
|
|
133
|
+
/** Options for {@link mergeMap}. */
|
|
134
|
+
interface MergeMapOptions {
|
|
135
|
+
/**
|
|
136
|
+
* Maximum number of live inner deps at once. `undefined`/`Infinity` keeps the default
|
|
137
|
+
* unbounded mergeMap behavior; finite values queue outer values until an inner COMPLETEs.
|
|
138
|
+
*/
|
|
139
|
+
readonly concurrent?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* switchMap: project each source value to an inner; on a new source value, CANCEL the in-flight
|
|
143
|
+
* inner (its source `_deactivate`s — abortInFlight) and switch to the new one. Only the current
|
|
144
|
+
* inner's emissions are forwarded.
|
|
145
|
+
*/
|
|
146
|
+
declare function switchMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
147
|
+
/**
|
|
148
|
+
* mergeMap (a.k.a. flatMap): project each source value to an inner and keep ALL inners live,
|
|
149
|
+
* interleaving their emissions. A completed inner is removed (memory bounding). On source/inner
|
|
150
|
+
* ERROR or projector failure, every live inner is removed before the operator emits ERROR (D81).
|
|
151
|
+
*/
|
|
152
|
+
declare function mergeMap<TIn, TOut>(project: Project<TIn, TOut>, opts?: MergeMapOptions): Operator<TIn, TOut>;
|
|
153
|
+
/** flatMap: alias of {@link mergeMap} (RxJS naming parity). */
|
|
154
|
+
declare function flatMap<TIn, TOut>(project: Project<TIn, TOut>, opts?: MergeMapOptions): Operator<TIn, TOut>;
|
|
155
|
+
/**
|
|
156
|
+
* concatMap: project each source value to an inner, but run AT MOST ONE inner at a time — queue
|
|
157
|
+
* later source values (lazy projection) and activate the next only when the active inner COMPLETEs.
|
|
158
|
+
* Preserves source order.
|
|
159
|
+
*/
|
|
160
|
+
declare function concatMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
161
|
+
/**
|
|
162
|
+
* exhaustMap: while an inner is active, DROP new source values; project the next source value only
|
|
163
|
+
* after the active inner COMPLETEs.
|
|
164
|
+
*/
|
|
165
|
+
declare function exhaustMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
166
|
+
/**
|
|
167
|
+
* repeat: play a source `count` times in sequence (RxJS `repeat`). A DEPLESS self-driving operator
|
|
168
|
+
* (Operator<never, S>, instantiate via `g.initNode(repeat(factory, count), [])`) — NOT a dep-operator.
|
|
169
|
+
*
|
|
170
|
+
* It takes a `factory: () => NodeInput<S>` (a RECIPE), not a source Node, because clean-slate Nodes
|
|
171
|
+
* are HOT/shared (multicast + cache): re-subscribing the SAME node replays its cache, it does not
|
|
172
|
+
* re-RUN the source. RxJS `repeat` re-subscribes the COLD source = a fresh subscription each round;
|
|
173
|
+
* the clean-slate analogue is a fresh node per round → a factory. (A `repeat(count)`-over-a-Node
|
|
174
|
+
* shape remains deferred: D47's no-net-change-is-a-no-op makes
|
|
175
|
+
* `unsubscribeDep(S)+subscribeDep(S)` on the SAME boundary cancel out. D115 keeps the model to
|
|
176
|
+
* ordinary unsubscribe plus a later subscribe, so same-node repeat needs a separate future design.)
|
|
177
|
+
*
|
|
178
|
+
* Mechanism (reuses the D47 self-rewire substrate, like the *Map family; NOT an internal subscribe,
|
|
179
|
+
* D45): on activation it mints round 0's inner via `ctx.rewireNext.subscribeDep`; each round's inner DATA
|
|
180
|
+
* is forwarded; on the inner's COMPLETE (`completeWhenDepsComplete:false + terminalAsRealInput:true`)
|
|
181
|
+
* it unsubscribeDep's the finished inner and, if rounds remain, subscribeDep's a FRESH `factory()` inner (a
|
|
182
|
+
* distinct node → a real net change, not the no-op same-node case); after the last round it emits
|
|
183
|
+
* COMPLETE. An inner ERROR auto-forwards (errorWhenDepsError default → repeat errors). The body is
|
|
184
|
+
* SELF-CATCHING (D30) and re-supplied on every rewire. The factory MUST mint a FRESH node per call
|
|
185
|
+
* (a factory returning the same Node makes unsubscribeDep+subscribeDep a net-zero no-op → repeat wedges).
|
|
186
|
+
*/
|
|
187
|
+
declare function repeat<S>(factory: () => NodeInput<S>, count: number): Operator<never, S>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Wall-clock time operators (CSP-2.7 / D52 / B23). Authored as COMPOSITIONS over the already-active
|
|
191
|
+
* higher-order *Map machinery (D47) + the `timer` source — NO raw `setTimeout` in any operator body
|
|
192
|
+
* (R-no-raw-async / check-no-raw-async; `setTimeout` stays confined to `sources.ts`'s `timer`). The
|
|
193
|
+
* timer source's `onDeactivation` clearTimeout IS the reset/cancel: switchMap's unsubscribeDep on a new
|
|
194
|
+
* source value tears the in-flight timer down (the declarative equivalent of the frozen reference's
|
|
195
|
+
* imperative clearTimeout-then-setTimeout). Per-language (D6/D24), never in parity.
|
|
196
|
+
*
|
|
197
|
+
* Shipped this cut (clean *Map+timer):
|
|
198
|
+
* - delay = mergeMap(v → timer(ms)→v) (every value delayed ms, ALL kept, order preserved)
|
|
199
|
+
* - debounce(Time) = switchMap(v → timer(ms)→v) (cancel-and-restart; emit the latest after quiet ms)
|
|
200
|
+
* - throttle(Time) = exhaustMap(v → [v now, alive ms]) (leading edge: emit v, ignore for ms)
|
|
201
|
+
*
|
|
202
|
+
* Behavior on source COMPLETE (per-operator, NOT a uniform DROP): debounce/debounceTime EMIT their
|
|
203
|
+
* pending trailing value — switchMap does not cancel the in-flight inner on source COMPLETE (only a
|
|
204
|
+
* superseding source value cancels it via unsubscribeDep→onDeactivation→clearTimeout), so the timer still
|
|
205
|
+
* fires at `ms`, emits the debounced value, and only THEN does the operator COMPLETE (RxJS
|
|
206
|
+
* debounceTime parity). delay emits every still-pending delayed value then COMPLETEs (mergeMap keeps
|
|
207
|
+
* all inners). throttle/throttleTime have NO trailing value (leading-edge only, RxJS default
|
|
208
|
+
* trailing:false) — an open window inner is dropped when the operator completes.
|
|
209
|
+
*
|
|
210
|
+
* B41 tail (landed 2026-05-31, the two shapes reflect WHEN the clock arms):
|
|
211
|
+
* - audit / auditTime — VALUE-TRIGGERED trailing edge: a source value opens a duration window
|
|
212
|
+
* (`audit(durationSelector)` = the general/notifier form, mirroring the *Map
|
|
213
|
+
* `Project` idiom + D46; `auditTime(ms)` = `audit(() => timer(ms))`), emits the
|
|
214
|
+
* window's LATEST value at the window's close. Self-wires the notifier via
|
|
215
|
+
* ctx.rewireNext — a normal `g.initNode(audit(sel), [source])` operator.
|
|
216
|
+
* - timeout / bufferTime — SUBSCRIBE-ARMED (RxJS-cold): the clock must run from activation, before
|
|
217
|
+
* any source value, so the timer/interval is a CONSTRUCTION-time dep (a depless
|
|
218
|
+
* source arms lazily on subscribe per node `_activate`). A dep-bearing operator
|
|
219
|
+
* body never runs at activation (only depless nodes do, node.ts), so these ship
|
|
220
|
+
* as graph composition HELPERS `timeout(source, ms)` / `bufferTime(source, ms)`
|
|
221
|
+
* returning a Node — NOT `g.initNode(op, [deps])` operators. timeout resets its
|
|
222
|
+
* idle timer per source value via ctx.rewireNext (ERROR on the gap); bufferTime
|
|
223
|
+
* is buffer-over-interval with terminal cleanup via ctx.rewireNext.
|
|
224
|
+
*
|
|
225
|
+
* NOT ported (D58): window/windowCount/windowTime — the Node<Node<T>> higher-order forms are a D45
|
|
226
|
+
* describe island; the array forms (buffer/bufferCount/bufferTime) are the graph-first equivalent.
|
|
227
|
+
*
|
|
228
|
+
* Inspection caveat (timeout/bufferTime): the helper returns a BARE node (free initNode) self-carrying
|
|
229
|
+
* its factory for describe auto-discovery (D51), but it is NOT in a graph's _entries — so g.describe()
|
|
230
|
+
* lists it only when it is a live dep of a registered node (a first-cut limit, like the *Map inners).
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* delay: shift every value by `ms`, preserving all values + order. `mergeMap` keeps every inner
|
|
235
|
+
* timer live (equal `ms`, so they fire in arrival order).
|
|
236
|
+
*/
|
|
237
|
+
declare function delay<S>(ms: number): Operator<S, S>;
|
|
238
|
+
/**
|
|
239
|
+
* debounce (alias `debounceTime`): emit the latest value only after `ms` of quiet. `switchMap`
|
|
240
|
+
* cancels the prior timer (its onDeactivation clearTimeout) on each new source value and restarts —
|
|
241
|
+
* the declarative debounce.
|
|
242
|
+
*
|
|
243
|
+
* RxJS-7 divergence (reference rxjs@7.8, B44): RxJS `debounceTime` FLUSHES the pending value
|
|
244
|
+
* IMMEDIATELY when the source COMPLETEs (its `_complete` calls `debouncedNext()` before
|
|
245
|
+
* `complete()`). This composition instead emits the pending value when the in-flight `timer(ms)`
|
|
246
|
+
* fires — i.e. at `(last-value-time + ms)` — so if the source completes mid-window the trailing
|
|
247
|
+
* value arrives up to `ms` later than RxJS. Inherent to the `*Map`+`timer` form (the composition
|
|
248
|
+
* cannot flush early without detecting COMPLETE inside the switchMap inner); accepted, not a bug.
|
|
249
|
+
*/
|
|
250
|
+
declare function debounce<S>(ms: number): Operator<S, S>;
|
|
251
|
+
/** debounceTime: RxJS-named alias of {@link debounce}. */
|
|
252
|
+
declare function debounceTime<S>(ms: number): Operator<S, S>;
|
|
253
|
+
/**
|
|
254
|
+
* throttle (alias `throttleTime`): leading-edge — emit a value immediately, then ignore the source
|
|
255
|
+
* for `ms`. `exhaustMap` drops new source values while the current window inner is alive; the
|
|
256
|
+
* window emits v at its leading edge and stays alive `ms`.
|
|
257
|
+
*
|
|
258
|
+
* Matches the RxJS-7 `throttleTime` DEFAULT (leading:true, trailing:false). The leading/trailing
|
|
259
|
+
* OPTIONS RxJS exposes are NOT provided (a capability gap, not a behavior divergence; B44) — add a
|
|
260
|
+
* trailing-window form if a consumer needs it.
|
|
261
|
+
*/
|
|
262
|
+
declare function throttle<S>(ms: number): Operator<S, S>;
|
|
263
|
+
/** throttleTime: RxJS-named alias of {@link throttle}. */
|
|
264
|
+
declare function throttleTime<S>(ms: number): Operator<S, S>;
|
|
265
|
+
/**
|
|
266
|
+
* audit: VALUE-TRIGGERED trailing throttle. A source value (when no window is open) opens a duration
|
|
267
|
+
* window via `durationSelector(value)` → a notifier `NodeInput` wired as dep 1 with `ctx.rewireNext`
|
|
268
|
+
* (D47 — the *Map self-rewire idiom, NOT an internal subscribe, D45); during the window new source
|
|
269
|
+
* values only UPDATE the tracked latest (no emit); when the notifier fires (its first DATA / COMPLETE)
|
|
270
|
+
* the window closes and the LATEST value is emitted. This is throttle's trailing-edge twin
|
|
271
|
+
* (throttle emits the window's FIRST value at the leading edge; audit emits the LAST at the close).
|
|
272
|
+
*
|
|
273
|
+
* `durationSelector` is the general/notifier form (mirrors the *Map `Project` idiom + D46); the source
|
|
274
|
+
* is dep 0, the live notifier (if any) is dep 1. On source COMPLETE the pending latest is FLUSHED then
|
|
275
|
+
* COMPLETE (RxJS-7 audit flush-on-complete, B44). A source/notifier ERROR is read as a real terminal
|
|
276
|
+
* input so the live notifier can be removed before ERROR. Self-catching (D30); re-supplies its body on
|
|
277
|
+
* every rewire.
|
|
278
|
+
*/
|
|
279
|
+
declare function audit<S>(durationSelector: (v: S) => NodeInput<unknown>): Operator<S, S>;
|
|
280
|
+
/** auditTime: the `ms`-specialization of {@link audit} — the window is a `timer(ms)`. */
|
|
281
|
+
declare function auditTime<S>(ms: number): Operator<S, S>;
|
|
282
|
+
/**
|
|
283
|
+
* timeout: idle watchdog — forward every source value, but ERROR if more than `ms` elapses with no
|
|
284
|
+
* value (RxJS `timeout(ms)`, `first === each === ms`). SUBSCRIBE-ARMED: the first `timer(ms)` is a
|
|
285
|
+
* CONSTRUCTION-time dep, so it arms when `timeout`'s node is subscribed/activated (a depless source
|
|
286
|
+
* runs lazily on `_activate`) — i.e. a source that never emits its FIRST value within `ms` still
|
|
287
|
+
* errors. A dep-bearing operator body never runs at activation (only depless nodes do, node.ts), which
|
|
288
|
+
* is why this is a HELPER returning a Node, not a `g.initNode(op, [source])` operator.
|
|
289
|
+
*
|
|
290
|
+
* Each source value forwards as-is and RESETS the idle timer (unsubscribeDep the current `timer(ms)`,
|
|
291
|
+
* subscribeDep a fresh one — its `onDeactivation` clearTimeout cancels the prior countdown). The timer
|
|
292
|
+
* firing (its DATA/COMPLETE) is the timeout → `[[ERROR]]`. Source COMPLETE forwards COMPLETE (no
|
|
293
|
+
* error) and removes the idle timer during the terminal wave (D62 terminal-drains-queued-rewire);
|
|
294
|
+
* a source ERROR forwards likewise. The idle timer is also torn down when the consumer unsubscribes
|
|
295
|
+
* (timeout deactivates → dep unsub → timer onDeactivation). Self-catching (D30).
|
|
296
|
+
*/
|
|
297
|
+
declare function timeout<S>(source: Node<S>, ms: number): Node<S>;
|
|
298
|
+
/**
|
|
299
|
+
* bufferTime: buffer source values and flush them as an array every `ms` (RxJS `bufferTime(ms)`).
|
|
300
|
+
* SUBSCRIBE-ARMED: the `interval(ms)` notifier is a CONSTRUCTION-time dep (arms on subscribe), so an
|
|
301
|
+
* empty window flushes `[]` even before the first source value — matching the landed {@link buffer}
|
|
302
|
+
* (which flushes on every notifier signal). On source COMPLETE the remainder flushes then COMPLETE
|
|
303
|
+
* (B44), and D62 lets the terminal wave still drain `unsubscribeDep(interval)` so the helper-owned
|
|
304
|
+
* interval source deactivates instead of ticking forever.
|
|
305
|
+
*/
|
|
306
|
+
declare function bufferTime<S>(source: Node<S>, ms: number): Node<S[]>;
|
|
307
|
+
|
|
308
|
+
export { type MergeMapOptions, Operator, type Project, audit, auditTime, buffer, bufferCount, bufferTime, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, exhaustMap, flatMap, mergeMap, race, repeat, sample, switchMap, takeUntil, throttle, throttleTime, timeout, withLatestFrom, zip };
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { L as Operator } from '../graph-DfdF9zy4.js';
|
|
2
|
+
export { D as DefineOpts, a as Definition, M as RestoreRegistryEntry, S as SettleOpts, U as TapObserver, $ as ValveOpts, a2 as catchError, a5 as define, a6 as distinctUntilChanged, a7 as elementAt, a8 as filter, aa as find, ab as first, ae as initNode, af as last, ag as map, ai as merge, ak as onFirstData, al as pairwise, am as reduce, an as rescue, ap as restoreRegistry, aq as scan, ar as settle, as as skip, au as take, aw as takeWhile, ax as tap, ay as tapFirst, aA as valve } from '../graph-DfdF9zy4.js';
|
|
3
|
+
import { N as NodeInput } from '../index-SnzZu3x7.js';
|
|
4
|
+
import { N as Node } from '../types-h12mNYbq.js';
|
|
5
|
+
import '../core/index.js';
|
|
6
|
+
import '../messages-BZqrGGm1.js';
|
|
7
|
+
import '../codec-BB7p8fJc.js';
|
|
8
|
+
import '../describe-BZb7AS2y.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Multi-source combinators + notifier-driven operators (CSP-2.7 catalog re-derive, D40 / D45).
|
|
12
|
+
*
|
|
13
|
+
* Per-language sugar (D6/D24, never in parity). Each forms topology ONLY via DECLARED deps (D45) —
|
|
14
|
+
* the frozen pure-ts reference (D41) builds these as a producer that calls `subscribeOr` on each
|
|
15
|
+
* source INSIDE the fn body, which is the D45-banned describe island (an edge `describe` cannot
|
|
16
|
+
* show). Re-derived here as static-dep nodes with `partial:true` (fire on any dep, R-first-run-gate
|
|
17
|
+
* off) + `ctx.state` (queue / phase / winner) — so every edge is a real subscription `describe`
|
|
18
|
+
* shows truthfully (D3 / R-edges-derived). Multi-source completion / error reads
|
|
19
|
+
* `depTerminal(ctx, i)` (R-deps-terminal) via `completeWhenDepsComplete:false +
|
|
20
|
+
* terminalAsRealInput:true`.
|
|
21
|
+
*
|
|
22
|
+
* Under D49 (no equals-absorption) `combine` emits a fresh tuple on EVERY contributing wave (no
|
|
23
|
+
* substrate tuple-dedup; the pure-ts `equals` tuple comparator is gone) — pair with
|
|
24
|
+
* `distinctUntilChanged` for opt-in dedup. SENTINEL ("a dep has never delivered DATA") is detected
|
|
25
|
+
* via `depLatest(ctx, i) === undefined` (R-sentinel: `undefined` is the global sentinel, `null` is a valid
|
|
26
|
+
* value).
|
|
27
|
+
*
|
|
28
|
+
* NOT re-derived in this cut (flagged): the window family (`window`/`windowCount`/`windowTime`)
|
|
29
|
+
* emits `Node<Node<T>>` nested sub-streams — the frozen reference creates child nodes inside the fn
|
|
30
|
+
* body and pushes DATA into them imperatively, which is a describe island AND an open question for
|
|
31
|
+
* how an emitted live sub-stream appears in `describe` (D45/D51). Deferred to a design pass.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* combine (alias `combineLatest`): emit a tuple of every dep's latest value whenever ANY dep
|
|
36
|
+
* delivers, once ALL deps have delivered at least one value. `partial:true`; the all-delivered gate
|
|
37
|
+
* is `depLatest(ctx, i) !== undefined` per dep. Completes when ALL deps complete (default
|
|
38
|
+
* completeWhenDepsComplete); any dep ERROR propagates (default errorWhenDepsError). Emits a fresh
|
|
39
|
+
* tuple per wave (D49 — no dedup; compose `distinctUntilChanged` to suppress unchanged tuples).
|
|
40
|
+
*/
|
|
41
|
+
declare function combine<T extends readonly unknown[]>(): Operator<unknown, T>;
|
|
42
|
+
/** combineLatest: RxJS-named alias of {@link combine}. */
|
|
43
|
+
declare const combineLatest: typeof combine;
|
|
44
|
+
/**
|
|
45
|
+
* withLatestFrom: on each PRIMARY (dep 0) value, emit `[primary, latestSecondary]`; a secondary-only
|
|
46
|
+
* (dep 1) wave updates the cached secondary but emits nothing. Uses the DEFAULT first-run gate
|
|
47
|
+
* (`partial:false`), NOT partial — the frozen reference's Phase 10.5 W1 fix: with `partial:true` the
|
|
48
|
+
* primary's push-on-subscribe fires the fn BEFORE the secondary has delivered, so the initial pair
|
|
49
|
+
* is dropped. The gate holds the first run until BOTH deps settle, then fires once with both
|
|
50
|
+
* populated; subsequent waves are gate-free and fire on primary-alone. Completes when the PRIMARY
|
|
51
|
+
* completes (not the secondary) — `completeWhenDepsComplete:false + terminalAsRealInput:true` with a
|
|
52
|
+
* primary-terminal check; a secondary terminal is ignored (its last value persists).
|
|
53
|
+
*/
|
|
54
|
+
declare function withLatestFrom<A, B>(): Operator<unknown, readonly [A, B]>;
|
|
55
|
+
/**
|
|
56
|
+
* zip: combine one value from EACH dep, in lockstep, into a tuple — buffering per-dep queues until
|
|
57
|
+
* every dep has at least one queued value, then shifting one from each. `partial:true` +
|
|
58
|
+
* `ctx.state` queues. Completes as soon as ANY dep is terminal AND its queue is empty (no further
|
|
59
|
+
* tuple can form) — `completeWhenDepsComplete:false + terminalAsRealInput:true`. Any dep ERROR
|
|
60
|
+
* propagates (default errorWhenDepsError).
|
|
61
|
+
*/
|
|
62
|
+
declare function zip<T extends readonly unknown[]>(): Operator<unknown, T>;
|
|
63
|
+
/**
|
|
64
|
+
* concat: play ALL of dep 0, then ALL of dep 1. Dep-1 DATA arriving during phase 0 is buffered and
|
|
65
|
+
* flushed at the handoff (dep 0 COMPLETE). `partial:true` + `ctx.state` phase. Completes when dep 1
|
|
66
|
+
* completes (or when dep 0 completes and dep 1 already had). `completeWhenDepsComplete:false +
|
|
67
|
+
* terminalAsRealInput:true`; any dep ERROR propagates (default errorWhenDepsError).
|
|
68
|
+
*/
|
|
69
|
+
declare function concat<S>(): Operator<S, S>;
|
|
70
|
+
/**
|
|
71
|
+
* race: the FIRST dep to deliver DATA wins; thereafter only the winner's messages flow (losers are
|
|
72
|
+
* dropped, including their terminals). `partial:true` + `ctx.state` winner. `errorWhenDepsError:false`
|
|
73
|
+
* (a LOSER's error must not error the race — only the winner's) + `completeWhenDepsComplete:false +
|
|
74
|
+
* terminalAsRealInput:true`. If every dep terminates before any DATA, COMPLETE.
|
|
75
|
+
*/
|
|
76
|
+
declare function race<S>(): Operator<S, S>;
|
|
77
|
+
/**
|
|
78
|
+
* buffer: accumulate dep 0 (source) DATA; flush the buffer as an array each time dep 1 (notifier)
|
|
79
|
+
* delivers DATA. `partial:true` + `ctx.state` buffer. On source COMPLETE, flush any remainder then
|
|
80
|
+
* COMPLETE (`completeWhenDepsComplete:false + terminalAsRealInput:true`; a notifier terminal is
|
|
81
|
+
* ignored). Source/notifier ERROR propagates (default errorWhenDepsError).
|
|
82
|
+
*/
|
|
83
|
+
declare function buffer<S>(): Operator<unknown, S[]>;
|
|
84
|
+
/**
|
|
85
|
+
* bufferCount: batch consecutive source DATA into arrays of length `count`; the remainder flushes on
|
|
86
|
+
* source COMPLETE. Single dep + `ctx.state` buffer + `completeWhenDepsComplete:false +
|
|
87
|
+
* terminalAsRealInput:true`.
|
|
88
|
+
*/
|
|
89
|
+
declare function bufferCount<S>(count: number): Operator<S, S[]>;
|
|
90
|
+
/**
|
|
91
|
+
* sample: emit the source's (dep 0) most recent value each time the notifier (dep 1) delivers DATA.
|
|
92
|
+
* `partial:true` + `ctx.state`. The notifier completing completes the operator; the source completing
|
|
93
|
+
* stops sampling (clears the held value); an ERROR from either terminates.
|
|
94
|
+
* `completeWhenDepsComplete:false + errorWhenDepsError:false + terminalAsRealInput:true` (manual
|
|
95
|
+
* terminal handling). No flush of the held value on source COMPLETE (RxJS sample semantics).
|
|
96
|
+
*/
|
|
97
|
+
declare function sample<S>(): Operator<unknown, S>;
|
|
98
|
+
/**
|
|
99
|
+
* takeUntil: forward dep 0 (source) DATA until dep 1 (notifier) delivers its first DATA, then
|
|
100
|
+
* COMPLETE. `partial:true` + `completeWhenDepsComplete:false + terminalAsRealInput:true`: a source
|
|
101
|
+
* COMPLETE forwards COMPLETE; a notifier DATA triggers COMPLETE. Source/notifier ERROR propagates
|
|
102
|
+
* (default errorWhenDepsError).
|
|
103
|
+
*/
|
|
104
|
+
declare function takeUntil<S>(): Operator<unknown, S>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Higher-order operators — switchMap / mergeMap / concatMap / exhaustMap / flatMap
|
|
108
|
+
* (D47 / R-rewire-deferred / CSP-2.7; per-language sugar, D6/D24, never in parity).
|
|
109
|
+
*
|
|
110
|
+
* Each projects every outer value to an INNER source and flattens the inners' emissions. The
|
|
111
|
+
* inner sources are wired as runtime DEPS via the deferred-self-rewire substrate affordance
|
|
112
|
+
* (`ctx.rewireNext`, D47) — NOT an internal subscribe (D45 bans that; it would create a describe
|
|
113
|
+
* island). Growing/shrinking the dep set is deferred to the committed wave boundary, so a fn
|
|
114
|
+
* never mutates its own topology mid-run (that is the D37 feedback-cycle ERROR). An inner that
|
|
115
|
+
* COMPLETEs is `unsubscribeDep`'d → its source `_deactivate`s + fires `onDeactivation`: that is the
|
|
116
|
+
* cancellation / abortInFlight basis (switchMap drops the superseded inner's WORK, not just its
|
|
117
|
+
* output; mergeMap bounds memory). Built on the bare `node` primitive via the {@link Operator}
|
|
118
|
+
* factory shape + the `g.initNode` funnel (D43), so the real factory name shows in describe.
|
|
119
|
+
*
|
|
120
|
+
* Lifecycle folding (D47/D81): completeWhenDepsComplete:false + terminalAsRealInput:true +
|
|
121
|
+
* errorWhenDepsError:false — the operator owns completion (emit COMPLETE only when the SOURCE is
|
|
122
|
+
* done AND no inner is live / pending), and observes source/inner ERROR so it can remove every live
|
|
123
|
+
* inner before emitting ERROR. Those removals drain after terminal via D62: terminal seals output,
|
|
124
|
+
* while helper-owned upstream work still sees unsubscribeDep->_deactivate->onDeactivation teardown.
|
|
125
|
+
*
|
|
126
|
+
* Alignment: each run issues REMOVES before ADDS so the per-node FIFO drain keeps the operator's
|
|
127
|
+
* tracked inner list aligned with the live dep order across the intermediate boundary waves (a
|
|
128
|
+
* removed dep is silent — no settle — and applies before any added dep's push-on-subscribe wave).
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/** Project an outer value to an inner source (a Node, Promise, (a)sync iterable, or scalar). */
|
|
132
|
+
type Project<TIn, TOut> = (value: TIn) => NodeInput<TOut>;
|
|
133
|
+
/** Options for {@link mergeMap}. */
|
|
134
|
+
interface MergeMapOptions {
|
|
135
|
+
/**
|
|
136
|
+
* Maximum number of live inner deps at once. `undefined`/`Infinity` keeps the default
|
|
137
|
+
* unbounded mergeMap behavior; finite values queue outer values until an inner COMPLETEs.
|
|
138
|
+
*/
|
|
139
|
+
readonly concurrent?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* switchMap: project each source value to an inner; on a new source value, CANCEL the in-flight
|
|
143
|
+
* inner (its source `_deactivate`s — abortInFlight) and switch to the new one. Only the current
|
|
144
|
+
* inner's emissions are forwarded.
|
|
145
|
+
*/
|
|
146
|
+
declare function switchMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
147
|
+
/**
|
|
148
|
+
* mergeMap (a.k.a. flatMap): project each source value to an inner and keep ALL inners live,
|
|
149
|
+
* interleaving their emissions. A completed inner is removed (memory bounding). On source/inner
|
|
150
|
+
* ERROR or projector failure, every live inner is removed before the operator emits ERROR (D81).
|
|
151
|
+
*/
|
|
152
|
+
declare function mergeMap<TIn, TOut>(project: Project<TIn, TOut>, opts?: MergeMapOptions): Operator<TIn, TOut>;
|
|
153
|
+
/** flatMap: alias of {@link mergeMap} (RxJS naming parity). */
|
|
154
|
+
declare function flatMap<TIn, TOut>(project: Project<TIn, TOut>, opts?: MergeMapOptions): Operator<TIn, TOut>;
|
|
155
|
+
/**
|
|
156
|
+
* concatMap: project each source value to an inner, but run AT MOST ONE inner at a time — queue
|
|
157
|
+
* later source values (lazy projection) and activate the next only when the active inner COMPLETEs.
|
|
158
|
+
* Preserves source order.
|
|
159
|
+
*/
|
|
160
|
+
declare function concatMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
161
|
+
/**
|
|
162
|
+
* exhaustMap: while an inner is active, DROP new source values; project the next source value only
|
|
163
|
+
* after the active inner COMPLETEs.
|
|
164
|
+
*/
|
|
165
|
+
declare function exhaustMap<TIn, TOut>(project: Project<TIn, TOut>): Operator<TIn, TOut>;
|
|
166
|
+
/**
|
|
167
|
+
* repeat: play a source `count` times in sequence (RxJS `repeat`). A DEPLESS self-driving operator
|
|
168
|
+
* (Operator<never, S>, instantiate via `g.initNode(repeat(factory, count), [])`) — NOT a dep-operator.
|
|
169
|
+
*
|
|
170
|
+
* It takes a `factory: () => NodeInput<S>` (a RECIPE), not a source Node, because clean-slate Nodes
|
|
171
|
+
* are HOT/shared (multicast + cache): re-subscribing the SAME node replays its cache, it does not
|
|
172
|
+
* re-RUN the source. RxJS `repeat` re-subscribes the COLD source = a fresh subscription each round;
|
|
173
|
+
* the clean-slate analogue is a fresh node per round → a factory. (A `repeat(count)`-over-a-Node
|
|
174
|
+
* shape remains deferred: D47's no-net-change-is-a-no-op makes
|
|
175
|
+
* `unsubscribeDep(S)+subscribeDep(S)` on the SAME boundary cancel out. D115 keeps the model to
|
|
176
|
+
* ordinary unsubscribe plus a later subscribe, so same-node repeat needs a separate future design.)
|
|
177
|
+
*
|
|
178
|
+
* Mechanism (reuses the D47 self-rewire substrate, like the *Map family; NOT an internal subscribe,
|
|
179
|
+
* D45): on activation it mints round 0's inner via `ctx.rewireNext.subscribeDep`; each round's inner DATA
|
|
180
|
+
* is forwarded; on the inner's COMPLETE (`completeWhenDepsComplete:false + terminalAsRealInput:true`)
|
|
181
|
+
* it unsubscribeDep's the finished inner and, if rounds remain, subscribeDep's a FRESH `factory()` inner (a
|
|
182
|
+
* distinct node → a real net change, not the no-op same-node case); after the last round it emits
|
|
183
|
+
* COMPLETE. An inner ERROR auto-forwards (errorWhenDepsError default → repeat errors). The body is
|
|
184
|
+
* SELF-CATCHING (D30) and re-supplied on every rewire. The factory MUST mint a FRESH node per call
|
|
185
|
+
* (a factory returning the same Node makes unsubscribeDep+subscribeDep a net-zero no-op → repeat wedges).
|
|
186
|
+
*/
|
|
187
|
+
declare function repeat<S>(factory: () => NodeInput<S>, count: number): Operator<never, S>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Wall-clock time operators (CSP-2.7 / D52 / B23). Authored as COMPOSITIONS over the already-active
|
|
191
|
+
* higher-order *Map machinery (D47) + the `timer` source — NO raw `setTimeout` in any operator body
|
|
192
|
+
* (R-no-raw-async / check-no-raw-async; `setTimeout` stays confined to `sources.ts`'s `timer`). The
|
|
193
|
+
* timer source's `onDeactivation` clearTimeout IS the reset/cancel: switchMap's unsubscribeDep on a new
|
|
194
|
+
* source value tears the in-flight timer down (the declarative equivalent of the frozen reference's
|
|
195
|
+
* imperative clearTimeout-then-setTimeout). Per-language (D6/D24), never in parity.
|
|
196
|
+
*
|
|
197
|
+
* Shipped this cut (clean *Map+timer):
|
|
198
|
+
* - delay = mergeMap(v → timer(ms)→v) (every value delayed ms, ALL kept, order preserved)
|
|
199
|
+
* - debounce(Time) = switchMap(v → timer(ms)→v) (cancel-and-restart; emit the latest after quiet ms)
|
|
200
|
+
* - throttle(Time) = exhaustMap(v → [v now, alive ms]) (leading edge: emit v, ignore for ms)
|
|
201
|
+
*
|
|
202
|
+
* Behavior on source COMPLETE (per-operator, NOT a uniform DROP): debounce/debounceTime EMIT their
|
|
203
|
+
* pending trailing value — switchMap does not cancel the in-flight inner on source COMPLETE (only a
|
|
204
|
+
* superseding source value cancels it via unsubscribeDep→onDeactivation→clearTimeout), so the timer still
|
|
205
|
+
* fires at `ms`, emits the debounced value, and only THEN does the operator COMPLETE (RxJS
|
|
206
|
+
* debounceTime parity). delay emits every still-pending delayed value then COMPLETEs (mergeMap keeps
|
|
207
|
+
* all inners). throttle/throttleTime have NO trailing value (leading-edge only, RxJS default
|
|
208
|
+
* trailing:false) — an open window inner is dropped when the operator completes.
|
|
209
|
+
*
|
|
210
|
+
* B41 tail (landed 2026-05-31, the two shapes reflect WHEN the clock arms):
|
|
211
|
+
* - audit / auditTime — VALUE-TRIGGERED trailing edge: a source value opens a duration window
|
|
212
|
+
* (`audit(durationSelector)` = the general/notifier form, mirroring the *Map
|
|
213
|
+
* `Project` idiom + D46; `auditTime(ms)` = `audit(() => timer(ms))`), emits the
|
|
214
|
+
* window's LATEST value at the window's close. Self-wires the notifier via
|
|
215
|
+
* ctx.rewireNext — a normal `g.initNode(audit(sel), [source])` operator.
|
|
216
|
+
* - timeout / bufferTime — SUBSCRIBE-ARMED (RxJS-cold): the clock must run from activation, before
|
|
217
|
+
* any source value, so the timer/interval is a CONSTRUCTION-time dep (a depless
|
|
218
|
+
* source arms lazily on subscribe per node `_activate`). A dep-bearing operator
|
|
219
|
+
* body never runs at activation (only depless nodes do, node.ts), so these ship
|
|
220
|
+
* as graph composition HELPERS `timeout(source, ms)` / `bufferTime(source, ms)`
|
|
221
|
+
* returning a Node — NOT `g.initNode(op, [deps])` operators. timeout resets its
|
|
222
|
+
* idle timer per source value via ctx.rewireNext (ERROR on the gap); bufferTime
|
|
223
|
+
* is buffer-over-interval with terminal cleanup via ctx.rewireNext.
|
|
224
|
+
*
|
|
225
|
+
* NOT ported (D58): window/windowCount/windowTime — the Node<Node<T>> higher-order forms are a D45
|
|
226
|
+
* describe island; the array forms (buffer/bufferCount/bufferTime) are the graph-first equivalent.
|
|
227
|
+
*
|
|
228
|
+
* Inspection caveat (timeout/bufferTime): the helper returns a BARE node (free initNode) self-carrying
|
|
229
|
+
* its factory for describe auto-discovery (D51), but it is NOT in a graph's _entries — so g.describe()
|
|
230
|
+
* lists it only when it is a live dep of a registered node (a first-cut limit, like the *Map inners).
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* delay: shift every value by `ms`, preserving all values + order. `mergeMap` keeps every inner
|
|
235
|
+
* timer live (equal `ms`, so they fire in arrival order).
|
|
236
|
+
*/
|
|
237
|
+
declare function delay<S>(ms: number): Operator<S, S>;
|
|
238
|
+
/**
|
|
239
|
+
* debounce (alias `debounceTime`): emit the latest value only after `ms` of quiet. `switchMap`
|
|
240
|
+
* cancels the prior timer (its onDeactivation clearTimeout) on each new source value and restarts —
|
|
241
|
+
* the declarative debounce.
|
|
242
|
+
*
|
|
243
|
+
* RxJS-7 divergence (reference rxjs@7.8, B44): RxJS `debounceTime` FLUSHES the pending value
|
|
244
|
+
* IMMEDIATELY when the source COMPLETEs (its `_complete` calls `debouncedNext()` before
|
|
245
|
+
* `complete()`). This composition instead emits the pending value when the in-flight `timer(ms)`
|
|
246
|
+
* fires — i.e. at `(last-value-time + ms)` — so if the source completes mid-window the trailing
|
|
247
|
+
* value arrives up to `ms` later than RxJS. Inherent to the `*Map`+`timer` form (the composition
|
|
248
|
+
* cannot flush early without detecting COMPLETE inside the switchMap inner); accepted, not a bug.
|
|
249
|
+
*/
|
|
250
|
+
declare function debounce<S>(ms: number): Operator<S, S>;
|
|
251
|
+
/** debounceTime: RxJS-named alias of {@link debounce}. */
|
|
252
|
+
declare function debounceTime<S>(ms: number): Operator<S, S>;
|
|
253
|
+
/**
|
|
254
|
+
* throttle (alias `throttleTime`): leading-edge — emit a value immediately, then ignore the source
|
|
255
|
+
* for `ms`. `exhaustMap` drops new source values while the current window inner is alive; the
|
|
256
|
+
* window emits v at its leading edge and stays alive `ms`.
|
|
257
|
+
*
|
|
258
|
+
* Matches the RxJS-7 `throttleTime` DEFAULT (leading:true, trailing:false). The leading/trailing
|
|
259
|
+
* OPTIONS RxJS exposes are NOT provided (a capability gap, not a behavior divergence; B44) — add a
|
|
260
|
+
* trailing-window form if a consumer needs it.
|
|
261
|
+
*/
|
|
262
|
+
declare function throttle<S>(ms: number): Operator<S, S>;
|
|
263
|
+
/** throttleTime: RxJS-named alias of {@link throttle}. */
|
|
264
|
+
declare function throttleTime<S>(ms: number): Operator<S, S>;
|
|
265
|
+
/**
|
|
266
|
+
* audit: VALUE-TRIGGERED trailing throttle. A source value (when no window is open) opens a duration
|
|
267
|
+
* window via `durationSelector(value)` → a notifier `NodeInput` wired as dep 1 with `ctx.rewireNext`
|
|
268
|
+
* (D47 — the *Map self-rewire idiom, NOT an internal subscribe, D45); during the window new source
|
|
269
|
+
* values only UPDATE the tracked latest (no emit); when the notifier fires (its first DATA / COMPLETE)
|
|
270
|
+
* the window closes and the LATEST value is emitted. This is throttle's trailing-edge twin
|
|
271
|
+
* (throttle emits the window's FIRST value at the leading edge; audit emits the LAST at the close).
|
|
272
|
+
*
|
|
273
|
+
* `durationSelector` is the general/notifier form (mirrors the *Map `Project` idiom + D46); the source
|
|
274
|
+
* is dep 0, the live notifier (if any) is dep 1. On source COMPLETE the pending latest is FLUSHED then
|
|
275
|
+
* COMPLETE (RxJS-7 audit flush-on-complete, B44). A source/notifier ERROR is read as a real terminal
|
|
276
|
+
* input so the live notifier can be removed before ERROR. Self-catching (D30); re-supplies its body on
|
|
277
|
+
* every rewire.
|
|
278
|
+
*/
|
|
279
|
+
declare function audit<S>(durationSelector: (v: S) => NodeInput<unknown>): Operator<S, S>;
|
|
280
|
+
/** auditTime: the `ms`-specialization of {@link audit} — the window is a `timer(ms)`. */
|
|
281
|
+
declare function auditTime<S>(ms: number): Operator<S, S>;
|
|
282
|
+
/**
|
|
283
|
+
* timeout: idle watchdog — forward every source value, but ERROR if more than `ms` elapses with no
|
|
284
|
+
* value (RxJS `timeout(ms)`, `first === each === ms`). SUBSCRIBE-ARMED: the first `timer(ms)` is a
|
|
285
|
+
* CONSTRUCTION-time dep, so it arms when `timeout`'s node is subscribed/activated (a depless source
|
|
286
|
+
* runs lazily on `_activate`) — i.e. a source that never emits its FIRST value within `ms` still
|
|
287
|
+
* errors. A dep-bearing operator body never runs at activation (only depless nodes do, node.ts), which
|
|
288
|
+
* is why this is a HELPER returning a Node, not a `g.initNode(op, [source])` operator.
|
|
289
|
+
*
|
|
290
|
+
* Each source value forwards as-is and RESETS the idle timer (unsubscribeDep the current `timer(ms)`,
|
|
291
|
+
* subscribeDep a fresh one — its `onDeactivation` clearTimeout cancels the prior countdown). The timer
|
|
292
|
+
* firing (its DATA/COMPLETE) is the timeout → `[[ERROR]]`. Source COMPLETE forwards COMPLETE (no
|
|
293
|
+
* error) and removes the idle timer during the terminal wave (D62 terminal-drains-queued-rewire);
|
|
294
|
+
* a source ERROR forwards likewise. The idle timer is also torn down when the consumer unsubscribes
|
|
295
|
+
* (timeout deactivates → dep unsub → timer onDeactivation). Self-catching (D30).
|
|
296
|
+
*/
|
|
297
|
+
declare function timeout<S>(source: Node<S>, ms: number): Node<S>;
|
|
298
|
+
/**
|
|
299
|
+
* bufferTime: buffer source values and flush them as an array every `ms` (RxJS `bufferTime(ms)`).
|
|
300
|
+
* SUBSCRIBE-ARMED: the `interval(ms)` notifier is a CONSTRUCTION-time dep (arms on subscribe), so an
|
|
301
|
+
* empty window flushes `[]` even before the first source value — matching the landed {@link buffer}
|
|
302
|
+
* (which flushes on every notifier signal). On source COMPLETE the remainder flushes then COMPLETE
|
|
303
|
+
* (B44), and D62 lets the terminal wave still drain `unsubscribeDep(interval)` so the helper-owned
|
|
304
|
+
* interval source deactivates instead of ticking forever.
|
|
305
|
+
*/
|
|
306
|
+
declare function bufferTime<S>(source: Node<S>, ms: number): Node<S[]>;
|
|
307
|
+
|
|
308
|
+
export { type MergeMapOptions, Operator, type Project, audit, auditTime, buffer, bufferCount, bufferTime, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, exhaustMap, flatMap, mergeMap, race, repeat, sample, switchMap, takeUntil, throttle, throttleTime, timeout, withLatestFrom, zip };
|