@fncts/observable 0.0.32 → 0.0.33
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 +26 -0
- package/_cjs/Action.cjs +15 -16
- package/_cjs/Action.cjs.map +1 -1
- package/_cjs/AnimationFrameAction.cjs +30 -35
- package/_cjs/AnimationFrameAction.cjs.map +1 -1
- package/_cjs/AnimationFrameScheduler.cjs +30 -35
- package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
- package/_cjs/AsyncAction.cjs +73 -93
- package/_cjs/AsyncAction.cjs.map +1 -1
- package/_cjs/AsyncScheduler.cjs +35 -41
- package/_cjs/AsyncScheduler.cjs.map +1 -1
- package/_cjs/BehaviorSubject.cjs +31 -38
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Notification.cjs +65 -66
- package/_cjs/Notification.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +23 -25
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +46 -50
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs +44 -48
- package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
- package/_cjs/Observable/api/fromEvent.cjs +15 -15
- package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
- package/_cjs/Observable/api/index.cjs +32 -160
- package/_cjs/Observable/api/race.cjs +26 -30
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +14 -15
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +54 -57
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +37 -41
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +73 -83
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +46 -43
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +45 -51
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +73 -74
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +71 -74
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +59 -55
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +1858 -2034
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +107 -120
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs +30 -33
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable/instances.cjs +0 -2
- package/_cjs/Observable.cjs +180 -215
- package/_cjs/ObservableRef/api.cjs +188 -189
- package/_cjs/ObservableRef/api.cjs.map +1 -1
- package/_cjs/ObservableRef/atomic.cjs +25 -25
- package/_cjs/ObservableRef/atomic.cjs.map +1 -1
- package/_cjs/ObservableRef/definition.cjs +32 -33
- package/_cjs/ObservableRef/definition.cjs.map +1 -1
- package/_cjs/ObservableRef.cjs +17 -39
- package/_cjs/Observer.cjs +0 -2
- package/_cjs/Operator.cjs +58 -62
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +38 -37
- package/_cjs/Scheduler.cjs.map +1 -1
- package/_cjs/Subject.cjs +163 -201
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs +151 -170
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/Subscription.cjs +98 -122
- package/_cjs/Subscription.cjs.map +1 -1
- package/_cjs/chunk.cjs +28 -0
- package/_cjs/config.cjs +11 -12
- package/_cjs/config.cjs.map +1 -1
- package/_cjs/global.cjs +0 -2
- package/_cjs/index.cjs +112 -36
- package/_cjs/internal/animationFrameProvider.cjs +32 -38
- package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
- package/_cjs/internal/args.cjs +12 -12
- package/_cjs/internal/args.cjs.map +1 -1
- package/_cjs/internal/intervalProvider.cjs +15 -22
- package/_cjs/internal/intervalProvider.cjs.map +1 -1
- package/_cjs/internal/performanceTimestampProvider.cjs +10 -11
- package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
- package/_cjs/internal/timeoutProvider.cjs +15 -22
- package/_cjs/internal/timeoutProvider.cjs.map +1 -1
- package/_cjs/internal/timestampProvider.cjs +10 -11
- package/_cjs/internal/timestampProvider.cjs.map +1 -1
- package/_cjs/internal/util.cjs +60 -68
- package/_cjs/internal/util.cjs.map +1 -1
- package/_mjs/Action.mjs +12 -8
- package/_mjs/Action.mjs.map +1 -1
- package/_mjs/AnimationFrameAction.mjs +25 -26
- package/_mjs/AnimationFrameAction.mjs.map +1 -1
- package/_mjs/AnimationFrameScheduler.mjs +25 -27
- package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
- package/_mjs/AsyncAction.mjs +69 -84
- package/_mjs/AsyncAction.mjs.map +1 -1
- package/_mjs/AsyncScheduler.mjs +31 -33
- package/_mjs/AsyncScheduler.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +28 -30
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Notification.mjs +57 -56
- package/_mjs/Notification.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +17 -17
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +39 -40
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/fromCallback.mjs +40 -41
- package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
- package/_mjs/Observable/api/fromEvent.mjs +12 -8
- package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
- package/_mjs/Observable/api/index.mjs +15 -15
- package/_mjs/Observable/api/race.mjs +20 -22
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +11 -8
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +48 -49
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +31 -33
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +65 -74
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +38 -34
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +39 -43
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +63 -64
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +58 -62
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +50 -46
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +1822 -2031
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +94 -108
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs +23 -23
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable/instances.mjs +0 -2
- package/_mjs/Observable.mjs +20 -25
- package/_mjs/ObservableRef/api.mjs +180 -177
- package/_mjs/ObservableRef/api.mjs.map +1 -1
- package/_mjs/ObservableRef/atomic.mjs +21 -17
- package/_mjs/ObservableRef/atomic.mjs.map +1 -1
- package/_mjs/ObservableRef/definition.mjs +29 -25
- package/_mjs/ObservableRef/definition.mjs.map +1 -1
- package/_mjs/ObservableRef.mjs +4 -5
- package/_mjs/Observer.mjs +0 -2
- package/_mjs/Operator.mjs +50 -51
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Scheduler.mjs +30 -26
- package/_mjs/Scheduler.mjs.map +1 -1
- package/_mjs/Subject.mjs +154 -190
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs +136 -156
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/Subscription.mjs +90 -112
- package/_mjs/Subscription.mjs.map +1 -1
- package/_mjs/config.mjs +10 -6
- package/_mjs/config.mjs.map +1 -1
- package/_mjs/global.mjs +0 -2
- package/_mjs/index.mjs +14 -15
- package/_mjs/internal/animationFrameProvider.mjs +28 -30
- package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
- package/_mjs/internal/args.mjs +9 -5
- package/_mjs/internal/args.mjs.map +1 -1
- package/_mjs/internal/intervalProvider.mjs +14 -16
- package/_mjs/internal/intervalProvider.mjs.map +1 -1
- package/_mjs/internal/performanceTimestampProvider.mjs +9 -5
- package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
- package/_mjs/internal/timeoutProvider.mjs +14 -16
- package/_mjs/internal/timeoutProvider.mjs.map +1 -1
- package/_mjs/internal/timestampProvider.mjs +9 -5
- package/_mjs/internal/timestampProvider.mjs.map +1 -1
- package/_mjs/internal/util.mjs +54 -59
- package/_mjs/internal/util.mjs.map +1 -1
- package/_src/Observable/api.ts +1 -1
- package/package.json +6 -2
- package/_cjs/Observable/api/index.cjs.map +0 -1
- package/_cjs/Observable/instances.cjs.map +0 -1
- package/_cjs/Observable.cjs.map +0 -1
- package/_cjs/ObservableRef.cjs.map +0 -1
- package/_cjs/Observer.cjs.map +0 -1
- package/_cjs/global.cjs.map +0 -1
- package/_cjs/index.cjs.map +0 -1
- package/_mjs/Observable/api/index.mjs.map +0 -1
- package/_mjs/Observable/instances.mjs.map +0 -1
- package/_mjs/Observable.mjs.map +0 -1
- package/_mjs/ObservableRef.mjs.map +0 -1
- package/_mjs/Observer.mjs.map +0 -1
- package/_mjs/global.mjs.map +0 -1
- package/_mjs/index.mjs.map +0 -1
package/_mjs/Observable/api.mjs
CHANGED
|
@@ -1,2194 +1,1985 @@
|
|
|
1
|
-
|
|
1
|
+
import * as tsplus_module_5 from "@fncts/observable/AsyncScheduler";
|
|
2
|
+
import * as tsplus_module_8 from "@fncts/observable/Operator";
|
|
3
|
+
import * as tsplus_module_7 from "@fncts/observable/Scheduler";
|
|
4
|
+
import { caughtSchedule } from "@fncts/observable/Scheduler";
|
|
5
|
+
import * as tsplus_module_6 from "@fncts/observable/Subscription";
|
|
6
|
+
import * as tsplus_module_3 from "@fncts/base/util/predicates";
|
|
7
|
+
import * as tsplus_module_20 from "@fncts/observable/Notification";
|
|
2
8
|
import * as tsplus_module_1 from "@fncts/base/data/Cause/api";
|
|
3
9
|
import * as tsplus_module_2 from "@fncts/observable/internal/util";
|
|
4
|
-
import
|
|
10
|
+
import { arrayOrObject, arrayRemove, readableStreamToAsyncGenerator } from "@fncts/observable/internal/util";
|
|
11
|
+
import * as tsplus_module_14 from "@fncts/base/data/Either/destructors";
|
|
12
|
+
import * as tsplus_module_19 from "@fncts/base/data/Either/constructors";
|
|
5
13
|
import * as tsplus_module_4 from "@fncts/io/IO";
|
|
6
|
-
import * as tsplus_module_5 from "@fncts/observable/AsyncScheduler";
|
|
7
|
-
import * as tsplus_module_6 from "@fncts/observable/Subscription";
|
|
8
|
-
import * as tsplus_module_7 from "@fncts/observable/Scheduler";
|
|
9
|
-
import * as tsplus_module_8 from "@fncts/observable/Operator";
|
|
10
14
|
import * as tsplus_module_9 from "@fncts/io/IO/api/environment";
|
|
11
15
|
import * as tsplus_module_10 from "@fncts/io/IO/runtime";
|
|
12
16
|
import * as tsplus_module_11 from "@fncts/base/data/Exit/api";
|
|
13
17
|
import * as tsplus_module_12 from "@fncts/io/Fiber/api/interrupt";
|
|
14
18
|
import * as tsplus_module_13 from "@fncts/base/data/function/api";
|
|
15
|
-
import * as tsplus_module_14 from "@fncts/base/data/Either/destructors";
|
|
16
19
|
import * as tsplus_module_15 from "@fncts/base/data/Maybe/destructors";
|
|
17
20
|
import * as tsplus_module_16 from "@fncts/base/data/Environment/api";
|
|
18
21
|
import * as tsplus_module_17 from "@fncts/base/data/Maybe/constructors";
|
|
19
22
|
import * as tsplus_module_18 from "@fncts/base/data/Maybe/definition";
|
|
20
|
-
import * as tsplus_module_19 from "@fncts/base/data/Either/constructors";
|
|
21
|
-
import * as tsplus_module_20 from "@fncts/observable/Notification";
|
|
22
23
|
import * as tsplus_module_21 from "@fncts/base/collection/immutable/HashSet/api";
|
|
23
|
-
export const defer = defer_1;
|
|
24
|
-
export const empty = empty_1;
|
|
25
|
-
export const environmentWithObservable = environmentWithObservable_1;
|
|
26
|
-
export const fail = fail_1;
|
|
27
|
-
export const from = from_1;
|
|
28
|
-
export const fromSubscribable = fromSubscribable_1;
|
|
29
|
-
export const _if = _if_1;
|
|
30
|
-
export const interval = interval_1;
|
|
31
|
-
export const of = of_1;
|
|
32
|
-
export const single = single_1;
|
|
33
|
-
export const scheduled = scheduled_1;
|
|
34
|
-
export const timer = timer_1;
|
|
35
|
-
export const fromIO = fromIO_1;
|
|
36
|
-
export const zipWith = zipWith_1;
|
|
37
|
-
export const mapWithIndex = mapWithIndex_1;
|
|
38
|
-
export const map_ = map_1;
|
|
39
|
-
export const as = as_1;
|
|
40
|
-
export const filterWithIndex = filterWithIndex_1;
|
|
41
|
-
export const filterMapWithIndex = filterMapWithIndex_1;
|
|
42
|
-
export const partitionWithIndex = partitionWithIndex_1;
|
|
43
|
-
export const partitionMapWithIndex = partitionMapWithIndex_1;
|
|
44
|
-
export const mergeMapWithIndex = mergeMapWithIndex_1;
|
|
45
|
-
export const mergeMap = mergeMap_1;
|
|
46
|
-
export const contramapEnvironment = contramapEnvironment_1;
|
|
47
|
-
export const foldLeftWithIndex = foldLeftWithIndex_1;
|
|
48
|
-
export const foldLeft = foldLeft_1;
|
|
49
|
-
export const audit = audit_1;
|
|
50
|
-
export const catchAllCause = catchAllCause_1;
|
|
51
|
-
export const concatAll = concatAll_1;
|
|
52
|
-
export const concat = concat_1;
|
|
53
|
-
export const countWithIndex = countWithIndex_1;
|
|
54
|
-
export const zipLatest = zipLatest_1;
|
|
55
|
-
export const delayWithIndex = delayWithIndex_1;
|
|
56
|
-
export const delayWith = delayWith_1;
|
|
57
|
-
export const exhaustMapWithIndex = exhaustMapWithIndex_1;
|
|
58
|
-
export const expandWithIndex = expandWithIndex_1;
|
|
59
|
-
export const findWithIndex = findWithIndex_1;
|
|
60
|
-
export const findIndexWithIndex = findIndexWithIndex_1;
|
|
61
|
-
export const mergeAll = mergeAll_1;
|
|
62
|
-
export const mergeScanWithIndex = mergeScanWithIndex_1;
|
|
63
|
-
export const onEmpty = onEmpty_1;
|
|
64
|
-
export const sample = sample_1;
|
|
65
|
-
export const scanLeftWithIndex = scanLeftWithIndex_1;
|
|
66
|
-
export const serviceWithObservable = serviceWithObservable_1;
|
|
67
|
-
export const switchMapWithIndex = switchMapWithIndex_1;
|
|
68
|
-
export const switchMap = switchMap_1;
|
|
69
|
-
export const switchScanWithIndex = switchScanWithIndex_1;
|
|
70
|
-
export const take = take_1;
|
|
71
|
-
export const takeWhileWithIndex = takeWhileWithIndex_1;
|
|
72
|
-
export const throttle = throttle_1;
|
|
73
|
-
export const toArray = toArray_1;
|
|
74
|
-
export const uniqueUntilChanged = uniqueUntilChanged_1;
|
|
75
24
|
import { popNumber } from "@fncts/observable/internal/args";
|
|
76
|
-
import { arrayOrObject, arrayRemove, readableStreamToAsyncGenerator } from "@fncts/observable/internal/util";
|
|
77
25
|
import { EMPTY, EnvironmentWith, Observable } from "@fncts/observable/Observable/definition";
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
26
|
+
//#region build/esm/Observable/api.js
|
|
27
|
+
const fileName_1 = "(@fncts/observable) src/Observable/api.ts";
|
|
28
|
+
const defer = defer_1;
|
|
29
|
+
const empty = empty_1;
|
|
30
|
+
const environmentWithObservable = environmentWithObservable_1;
|
|
31
|
+
const fail = fail_1;
|
|
32
|
+
const from = from_1;
|
|
33
|
+
const fromSubscribable = fromSubscribable_1;
|
|
34
|
+
const _if = _if_1;
|
|
35
|
+
const interval = interval_1;
|
|
36
|
+
const of = of_1;
|
|
37
|
+
const single = single_1;
|
|
38
|
+
const scheduled = scheduled_1;
|
|
39
|
+
const timer = timer_1;
|
|
40
|
+
const fromIO = fromIO_1;
|
|
41
|
+
const zipWith = zipWith_1;
|
|
42
|
+
const mapWithIndex = mapWithIndex_1;
|
|
43
|
+
const map_ = map_1;
|
|
44
|
+
const as = as_1;
|
|
45
|
+
const filterWithIndex = filterWithIndex_1;
|
|
46
|
+
const filterMapWithIndex = filterMapWithIndex_1;
|
|
47
|
+
const partitionWithIndex = partitionWithIndex_1;
|
|
48
|
+
const partitionMapWithIndex = partitionMapWithIndex_1;
|
|
49
|
+
const mergeMapWithIndex = mergeMapWithIndex_1;
|
|
50
|
+
const mergeMap = mergeMap_1;
|
|
51
|
+
const contramapEnvironment = contramapEnvironment_1;
|
|
52
|
+
const foldLeftWithIndex = foldLeftWithIndex_1;
|
|
53
|
+
const foldLeft = foldLeft_1;
|
|
54
|
+
const audit = audit_1;
|
|
55
|
+
const catchAllCause = catchAllCause_1;
|
|
56
|
+
const concatAll = concatAll_1;
|
|
57
|
+
const concat = concat_1;
|
|
58
|
+
const countWithIndex = countWithIndex_1;
|
|
59
|
+
const zipLatest = zipLatest_1;
|
|
60
|
+
const delayWithIndex = delayWithIndex_1;
|
|
61
|
+
const delayWith = delayWith_1;
|
|
62
|
+
const exhaustMapWithIndex = exhaustMapWithIndex_1;
|
|
63
|
+
const expandWithIndex = expandWithIndex_1;
|
|
64
|
+
const findWithIndex = findWithIndex_1;
|
|
65
|
+
const findIndexWithIndex = findIndexWithIndex_1;
|
|
66
|
+
const mergeAll = mergeAll_1;
|
|
67
|
+
const mergeScanWithIndex = mergeScanWithIndex_1;
|
|
68
|
+
const onEmpty = onEmpty_1;
|
|
69
|
+
const sample = sample_1;
|
|
70
|
+
const scanLeftWithIndex = scanLeftWithIndex_1;
|
|
71
|
+
const serviceWithObservable = serviceWithObservable_1;
|
|
72
|
+
const switchMapWithIndex = switchMapWithIndex_1;
|
|
73
|
+
const switchMap = switchMap_1;
|
|
74
|
+
const switchScanWithIndex = switchScanWithIndex_1;
|
|
75
|
+
const take = take_1;
|
|
76
|
+
const takeWhileWithIndex = takeWhileWithIndex_1;
|
|
77
|
+
const throttle = throttle_1;
|
|
78
|
+
const toArray = toArray_1;
|
|
79
|
+
const uniqueUntilChanged = uniqueUntilChanged_1;
|
|
80
|
+
/**
|
|
81
|
+
* @tsplus static fncts.observable.ObservableOps halt
|
|
82
|
+
*/
|
|
83
|
+
function halt(defect) {
|
|
84
|
+
return new Observable((s) => s.error(tsplus_module_1.halt(defect)));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @tsplus static fncts.observable.ObservableOps defer
|
|
88
|
+
*/
|
|
88
89
|
function defer_1(observable) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
return new Observable((s, environment) => {
|
|
91
|
+
from_1(observable()).provideEnvironment(environment).subscribe(s);
|
|
92
|
+
});
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
* @tsplus static fncts.observable.ObservableOps empty
|
|
96
|
+
*/
|
|
96
97
|
function empty_1() {
|
|
97
|
-
|
|
98
|
+
return EMPTY;
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* @tsplus static fncts.observable.ObservableOps environmentWithObservable
|
|
102
|
+
*/
|
|
102
103
|
function environmentWithObservable_1(f) {
|
|
103
|
-
|
|
104
|
+
return new EnvironmentWith(f);
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
* @tsplus static fncts.observable.ObservableOps failCause
|
|
108
|
+
*/
|
|
109
|
+
function failCause(cause) {
|
|
110
|
+
return new Observable((s) => s.error(cause));
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
* @tsplus static fncts.observable.ObservableOps fail
|
|
114
|
+
*/
|
|
114
115
|
function fail_1(e) {
|
|
115
|
-
|
|
116
|
+
return new Observable((s) => s.error(tsplus_module_1.fail(e)));
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
* @tsplus static fncts.observable.ObservableOps from
|
|
120
|
+
*/
|
|
120
121
|
function from_1(input) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
s.complete();
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
export function fromPromise(promise) {
|
|
172
|
-
return new Observable(s => {
|
|
173
|
-
promise.then(value => {
|
|
174
|
-
if (!s._closed) {
|
|
175
|
-
s.next(value);
|
|
176
|
-
s.complete();
|
|
177
|
-
}
|
|
178
|
-
}, err => s.error(tsplus_module_1.halt(err))).then(null, tsplus_module_2.reportUnhandledError);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
export function fromReadableStreamLike(readableStream) {
|
|
182
|
-
return fromAsyncIterable(readableStreamToAsyncGenerator(readableStream));
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* @tsplus static fncts.observable.ObservableOps fromSubscribable
|
|
186
|
-
*/
|
|
122
|
+
if (input instanceof Observable) return input;
|
|
123
|
+
if (tsplus_module_2.isArrayLike(input)) return fromArrayLike(input);
|
|
124
|
+
if (tsplus_module_2.isPromiseLike(input)) return fromPromise(input);
|
|
125
|
+
if (tsplus_module_2.isAsyncIterable(input)) return fromAsyncIterable(input);
|
|
126
|
+
if (tsplus_module_3.isIterable(input)) return fromIterable(input);
|
|
127
|
+
if (tsplus_module_2.isReadableStream(input)) return fromReadableStreamLike(input);
|
|
128
|
+
if (tsplus_module_4.isIO(input)) return fromIO_1(input);
|
|
129
|
+
if ("subscribe" in input) return fromSubscribable_1(input);
|
|
130
|
+
throw new TypeError("Invalid Observable input");
|
|
131
|
+
}
|
|
132
|
+
function fromArrayLike(input) {
|
|
133
|
+
return new Observable((s) => {
|
|
134
|
+
for (let i = 0; i < input.length && !s._closed; i++) s.next(input[i]);
|
|
135
|
+
s.complete();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function fromAsyncIterable(asyncIterable) {
|
|
139
|
+
return new Observable((s) => {
|
|
140
|
+
process(asyncIterable, s).catch((err) => s.error(tsplus_module_1.halt(err)));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function fromIterable(iterable) {
|
|
144
|
+
return new Observable((s) => {
|
|
145
|
+
for (const value of iterable) {
|
|
146
|
+
s.next(value);
|
|
147
|
+
if (s._closed) return;
|
|
148
|
+
}
|
|
149
|
+
s.complete();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function fromPromise(promise) {
|
|
153
|
+
return new Observable((s) => {
|
|
154
|
+
promise.then((value) => {
|
|
155
|
+
if (!s._closed) {
|
|
156
|
+
s.next(value);
|
|
157
|
+
s.complete();
|
|
158
|
+
}
|
|
159
|
+
}, (err) => s.error(tsplus_module_1.halt(err))).then(null, tsplus_module_2.reportUnhandledError);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function fromReadableStreamLike(readableStream) {
|
|
163
|
+
return fromAsyncIterable(readableStreamToAsyncGenerator(readableStream));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @tsplus static fncts.observable.ObservableOps fromSubscribable
|
|
167
|
+
*/
|
|
187
168
|
function fromSubscribable_1(subscribable) {
|
|
188
|
-
|
|
169
|
+
return new Observable((subscriber) => subscribable.subscribe(subscriber));
|
|
189
170
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
171
|
+
function fromInterop(subscribable) {
|
|
172
|
+
return new Observable((subscriber) => subscribable.subscribe({
|
|
173
|
+
next: (value) => subscriber.next(value),
|
|
174
|
+
error: (err) => subscriber.error(tsplus_module_1.halt(err)),
|
|
175
|
+
complete: () => subscriber.complete()
|
|
176
|
+
}));
|
|
196
177
|
}
|
|
197
178
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
179
|
+
* @tsplus static fncts.observable.ObservableOps if
|
|
180
|
+
*/
|
|
200
181
|
function _if_1(condition, onTrue, onFalse) {
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
scheduler
|
|
213
|
-
} = options;
|
|
214
|
-
function* gen() {
|
|
215
|
-
for (let state = initialState; !cont || cont(state); state = iterate(state)) {
|
|
216
|
-
yield state;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return defer_1(scheduler ? () => scheduleIterable(gen(), scheduler) : gen);
|
|
182
|
+
return defer_1(() => condition() ? onTrue : onFalse);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @tsplus static fncts.observable.ObservableOps iterate
|
|
186
|
+
*/
|
|
187
|
+
function iterate(options) {
|
|
188
|
+
const { initialState, cont, iterate, scheduler } = options;
|
|
189
|
+
function* gen() {
|
|
190
|
+
for (let state = initialState; !cont || cont(state); state = iterate(state)) yield state;
|
|
191
|
+
}
|
|
192
|
+
return defer_1(scheduler ? () => scheduleIterable(gen(), scheduler) : gen);
|
|
220
193
|
}
|
|
221
194
|
async function process(asyncIterable, subscriber) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
subscriber.complete();
|
|
195
|
+
for await (const value of asyncIterable) {
|
|
196
|
+
subscriber.next(value);
|
|
197
|
+
if (subscriber._closed) return;
|
|
198
|
+
}
|
|
199
|
+
subscriber.complete();
|
|
229
200
|
}
|
|
230
201
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
202
|
+
* @tsplus static fncts.obervable.ObservableOps interval
|
|
203
|
+
*/
|
|
233
204
|
function interval_1(period = 0, scheduler = tsplus_module_5.asyncScheduler) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
return timer_1(period, period, scheduler);
|
|
205
|
+
if (period < 0) period = 0;
|
|
206
|
+
return timer_1(period, period, scheduler);
|
|
238
207
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
208
|
+
function merge(...sources) {
|
|
209
|
+
const concurrency = popNumber(sources, Infinity);
|
|
210
|
+
return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(concurrency)(fromArrayLike(sources));
|
|
242
211
|
}
|
|
243
212
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
213
|
+
* @tsplus static fncts.observable.ObservableOps of
|
|
214
|
+
*/
|
|
246
215
|
function of_1(...items) {
|
|
247
|
-
|
|
216
|
+
return fromArrayLike(items);
|
|
248
217
|
}
|
|
249
218
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
219
|
+
* @tsplus static fncts.observable.ObservableOps single
|
|
220
|
+
*/
|
|
252
221
|
function single_1(a) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
222
|
+
return new Observable((s) => {
|
|
223
|
+
s.next(a);
|
|
224
|
+
s.complete();
|
|
225
|
+
});
|
|
257
226
|
}
|
|
258
227
|
/**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
228
|
+
* @tsplus pipeable fncts.observable.Observable scheduled
|
|
229
|
+
* @tsplus static fncts.observable.ObservableOps scheduled
|
|
230
|
+
*/
|
|
262
231
|
function scheduled_1(scheduler) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
export function schedulePromise(input, scheduler) {
|
|
356
|
-
return new Observable(subscriber => {
|
|
357
|
-
return scheduler.schedule(() => {
|
|
358
|
-
input.then(value => {
|
|
359
|
-
subscriber.add(scheduler.schedule(() => {
|
|
360
|
-
subscriber.next(value);
|
|
361
|
-
subscriber.add(scheduler.schedule(() => subscriber.complete()));
|
|
362
|
-
}));
|
|
363
|
-
}, err => {
|
|
364
|
-
subscriber.add(scheduler.schedule(() => subscriber.error(tsplus_module_1.halt(err))));
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
export function scheduleReadableStreamLike(input, scheduler) {
|
|
370
|
-
return scheduleAsyncIterable(readableStreamToAsyncGenerator(input), scheduler);
|
|
232
|
+
return (input) => {
|
|
233
|
+
if (tsplus_module_2.isArrayLike(input)) return scheduleArray(input, scheduler);
|
|
234
|
+
if (tsplus_module_2.isPromiseLike(input)) return schedulePromise(input, scheduler);
|
|
235
|
+
if (tsplus_module_3.isIterable(input)) return scheduleIterable(input, scheduler);
|
|
236
|
+
if (tsplus_module_2.isAsyncIterable(input)) return scheduleAsyncIterable(input, scheduler);
|
|
237
|
+
if (tsplus_module_2.isReadableStream(input)) return scheduleReadableStreamLike(input, scheduler);
|
|
238
|
+
return scheduleObservable(from_1(input), scheduler);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function scheduleArray(input, scheduler) {
|
|
242
|
+
return new Observable((s) => {
|
|
243
|
+
let i = 0;
|
|
244
|
+
return scheduler.schedule(function() {
|
|
245
|
+
if (i === input.length) s.complete();
|
|
246
|
+
else {
|
|
247
|
+
s.next(input[i++]);
|
|
248
|
+
if (!s._closed) this.schedule();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function scheduleAsyncIterable(input, scheduler) {
|
|
254
|
+
return new Observable((subscriber) => {
|
|
255
|
+
const sub = new tsplus_module_6.Subscription();
|
|
256
|
+
sub.add(scheduler.schedule(() => {
|
|
257
|
+
const iterator = input[Symbol.asyncIterator]();
|
|
258
|
+
sub.add(scheduler.schedule(function() {
|
|
259
|
+
iterator.next().then((result) => {
|
|
260
|
+
if (result.done) subscriber.complete();
|
|
261
|
+
else {
|
|
262
|
+
subscriber.next(result.value);
|
|
263
|
+
this.schedule();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}));
|
|
267
|
+
}));
|
|
268
|
+
return sub;
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function scheduleIterable(input, scheduler) {
|
|
272
|
+
return new Observable((s) => {
|
|
273
|
+
let iterator;
|
|
274
|
+
s.add(scheduler.schedule(() => {
|
|
275
|
+
iterator = input[Symbol.iterator]();
|
|
276
|
+
caughtSchedule(s, scheduler, function() {
|
|
277
|
+
const { value, done } = iterator.next();
|
|
278
|
+
if (done) s.complete();
|
|
279
|
+
else {
|
|
280
|
+
s.next(value);
|
|
281
|
+
this.schedule();
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}));
|
|
285
|
+
return () => tsplus_module_3.isFunction(iterator?.return) && iterator.return();
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function scheduleObservable(input, scheduler) {
|
|
289
|
+
return new Observable((subscriber, environment) => {
|
|
290
|
+
const sub = new tsplus_module_6.Subscription();
|
|
291
|
+
sub.add(scheduler.schedule(() => {
|
|
292
|
+
sub.add(input.provideEnvironment(environment).subscribe({
|
|
293
|
+
next: (value) => {
|
|
294
|
+
sub.add(scheduler.schedule(() => subscriber.next(value)));
|
|
295
|
+
},
|
|
296
|
+
error: (err) => {
|
|
297
|
+
sub.add(scheduler.schedule(() => subscriber.error(err)));
|
|
298
|
+
},
|
|
299
|
+
complete: () => {
|
|
300
|
+
sub.add(scheduler.schedule(() => subscriber.complete()));
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
}));
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function schedulePromise(input, scheduler) {
|
|
307
|
+
return new Observable((subscriber) => {
|
|
308
|
+
return scheduler.schedule(() => {
|
|
309
|
+
input.then((value) => {
|
|
310
|
+
subscriber.add(scheduler.schedule(() => {
|
|
311
|
+
subscriber.next(value);
|
|
312
|
+
subscriber.add(scheduler.schedule(() => subscriber.complete()));
|
|
313
|
+
}));
|
|
314
|
+
}, (err) => {
|
|
315
|
+
subscriber.add(scheduler.schedule(() => subscriber.error(tsplus_module_1.halt(err))));
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function scheduleReadableStreamLike(input, scheduler) {
|
|
321
|
+
return scheduleAsyncIterable(readableStreamToAsyncGenerator(input), scheduler);
|
|
371
322
|
}
|
|
372
323
|
function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyncScheduler) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
complete: () => {
|
|
422
|
-
completed[sourceIndex] = true;
|
|
423
|
-
!buffers[sourceIndex].length && subscriber.complete();
|
|
424
|
-
}
|
|
425
|
-
}));
|
|
426
|
-
}
|
|
427
|
-
return () => {
|
|
428
|
-
buffers = completed = null;
|
|
429
|
-
};
|
|
430
|
-
}) : empty_1();
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @tsplus static fncts.observable.ObservableOps fromIO
|
|
434
|
-
*/
|
|
324
|
+
let intervalDuration = -1;
|
|
325
|
+
if (intervalOrScheduler != null) if (tsplus_module_7.isScheduler(intervalOrScheduler)) scheduler = intervalOrScheduler;
|
|
326
|
+
else intervalDuration = intervalOrScheduler;
|
|
327
|
+
return new Observable((s) => {
|
|
328
|
+
let due = tsplus_module_2.isValidDate(time) ? +time - scheduler.now() : time;
|
|
329
|
+
if (due < 0) due = 0;
|
|
330
|
+
let n = 0;
|
|
331
|
+
return scheduler.schedule(function() {
|
|
332
|
+
if (!s._closed) {
|
|
333
|
+
s.next(n++);
|
|
334
|
+
if (0 <= intervalDuration) this.schedule(void 0, intervalDuration);
|
|
335
|
+
else s.complete();
|
|
336
|
+
}
|
|
337
|
+
}, due);
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @tsplus static fncts.observable.ObservableOps zip
|
|
342
|
+
*/
|
|
343
|
+
function makeZip(...sources) {
|
|
344
|
+
return sources.length ? new Observable((subscriber, environment) => {
|
|
345
|
+
let buffers = sources.map(() => []);
|
|
346
|
+
let completed = sources.map(() => false);
|
|
347
|
+
subscriber.add(() => {
|
|
348
|
+
buffers = completed = null;
|
|
349
|
+
});
|
|
350
|
+
for (let sourceIndex = 0; !subscriber._closed && sourceIndex < sources.length; sourceIndex++) from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
351
|
+
next: (value) => {
|
|
352
|
+
buffers[sourceIndex].push(value);
|
|
353
|
+
if (buffers.every((buffer) => buffer.length)) {
|
|
354
|
+
const result = buffers.map((buffer) => buffer.shift());
|
|
355
|
+
subscriber.next(result);
|
|
356
|
+
if (buffers.some((buffer, i) => !buffer.length && completed[i])) subscriber.complete();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
complete: () => {
|
|
360
|
+
completed[sourceIndex] = true;
|
|
361
|
+
!buffers[sourceIndex].length && subscriber.complete();
|
|
362
|
+
}
|
|
363
|
+
}));
|
|
364
|
+
return () => {
|
|
365
|
+
buffers = completed = null;
|
|
366
|
+
};
|
|
367
|
+
}) : empty_1();
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @tsplus static fncts.observable.ObservableOps fromIO
|
|
371
|
+
*/
|
|
435
372
|
function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
|
|
459
|
-
|
|
373
|
+
return new Observable((s, env) => {
|
|
374
|
+
let fiber;
|
|
375
|
+
const scheduled = scheduler.schedule(() => {
|
|
376
|
+
fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":493:36")(io), fileName_1 + ":493:56");
|
|
377
|
+
fiber.addObserver((exit) => {
|
|
378
|
+
if (!s._closed) {
|
|
379
|
+
tsplus_module_11.match((cause) => s.error(cause), (a) => s.next(a))(exit);
|
|
380
|
+
s.complete();
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
return () => {
|
|
385
|
+
scheduled.unsubscribe();
|
|
386
|
+
fiber && tsplus_module_10.unsafeRunFiber(tsplus_module_12.interrupt(fiber), fileName_1 + ":506:46");
|
|
387
|
+
};
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* @tsplus static fncts.observable.ObservableOps unit
|
|
392
|
+
*/
|
|
393
|
+
const unit = single_1(void 0);
|
|
394
|
+
/**
|
|
395
|
+
* @tsplus pipeable fncts.observable.Observable zipWith
|
|
396
|
+
*/
|
|
460
397
|
function zipWith_1(fb, f) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
398
|
+
return (fa) => {
|
|
399
|
+
return mergeMap_1((a) => map_1((b) => f(a, b))(fb))(fa);
|
|
400
|
+
};
|
|
464
401
|
}
|
|
465
402
|
/**
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
403
|
+
* @tsplus pipeable fncts.observable.Observable zip
|
|
404
|
+
*/
|
|
405
|
+
function zip(fb) {
|
|
406
|
+
return (fa) => {
|
|
407
|
+
return zipWith_1(fb, tsplus_module_13.tuple)(fa);
|
|
408
|
+
};
|
|
472
409
|
}
|
|
473
410
|
/**
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
411
|
+
* @tsplus pipeable fncts.observable.Observable ap
|
|
412
|
+
*/
|
|
413
|
+
function ap(fa) {
|
|
414
|
+
return (fab) => {
|
|
415
|
+
return zipWith_1(fa, (f, a) => f(a))(fab);
|
|
416
|
+
};
|
|
480
417
|
}
|
|
481
418
|
/**
|
|
482
|
-
|
|
483
|
-
|
|
419
|
+
* @tsplus pipeable fncts.observable.Observable mapWithIndex
|
|
420
|
+
*/
|
|
484
421
|
function mapWithIndex_1(f) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
* @tsplus pipeable fncts.observable.Observable map
|
|
498
|
-
*/
|
|
422
|
+
return (fa) => {
|
|
423
|
+
return new Observable((destination, environment) => {
|
|
424
|
+
let i = 0;
|
|
425
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
426
|
+
destination.next(f(i++, value));
|
|
427
|
+
} })(destination));
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @tsplus pipeable fncts.observable.Observable map
|
|
433
|
+
*/
|
|
499
434
|
function map_1(f) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
435
|
+
return (fa) => {
|
|
436
|
+
return mapWithIndex_1((_, a) => f(a))(fa);
|
|
437
|
+
};
|
|
503
438
|
}
|
|
504
439
|
/**
|
|
505
|
-
|
|
506
|
-
|
|
440
|
+
* @tsplus pipeable fncts.observable.Observable as
|
|
441
|
+
*/
|
|
507
442
|
function as_1(b) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
})(subscriber));
|
|
543
|
-
});
|
|
443
|
+
return (fa) => {
|
|
444
|
+
return map_1(b)(fa);
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @tsplus pipeable fncts.observable.Observable mapError
|
|
449
|
+
*/
|
|
450
|
+
function mapError(f) {
|
|
451
|
+
return (fa) => {
|
|
452
|
+
return new Observable((subscriber, environment) => {
|
|
453
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ error: (err) => {
|
|
454
|
+
subscriber.error(tsplus_module_1.map(f)(err));
|
|
455
|
+
} })(subscriber));
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* @tsplus getter fncts.observable.Observable swap
|
|
461
|
+
*/
|
|
462
|
+
function swap(fa) {
|
|
463
|
+
return new Observable((subscriber, environment) => {
|
|
464
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
465
|
+
next: (value) => {
|
|
466
|
+
subscriber.error(tsplus_module_1.fail(value));
|
|
467
|
+
},
|
|
468
|
+
error: (err) => {
|
|
469
|
+
tsplus_module_14.match((e) => {
|
|
470
|
+
subscriber.next(e);
|
|
471
|
+
}, (cause) => {
|
|
472
|
+
subscriber.error(cause);
|
|
473
|
+
})(tsplus_module_1.failureOrCause(err));
|
|
474
|
+
}
|
|
475
|
+
})(subscriber));
|
|
476
|
+
});
|
|
544
477
|
}
|
|
545
478
|
function filterWithIndex_1(predicate) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
* @tsplus pipeable fncts.observable.Observable filterMapWithIndex
|
|
562
|
-
*/
|
|
479
|
+
return (fa) => {
|
|
480
|
+
return new Observable((subscriber, environment) => {
|
|
481
|
+
let index = 0;
|
|
482
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => predicate(index++, value) && subscriber.next(value) })(subscriber));
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function filter(predicate) {
|
|
487
|
+
return (fa) => {
|
|
488
|
+
return filterWithIndex_1((_, a) => predicate(a))(fa);
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @tsplus pipeable fncts.observable.Observable filterMapWithIndex
|
|
493
|
+
*/
|
|
563
494
|
function filterMapWithIndex_1(f) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
return filterMapWithIndex_1((_, a) => f(a))(fa);
|
|
579
|
-
};
|
|
495
|
+
return (fa) => {
|
|
496
|
+
return new Observable((subscriber, environment) => {
|
|
497
|
+
let index = 0;
|
|
498
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => tsplus_module_15.match(() => tsplus_module_2.noop, (b) => subscriber.next(b))(f(index++, value)) })(subscriber));
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* @tsplus pipeable fncts.observable.Observable filterMap
|
|
504
|
+
*/
|
|
505
|
+
function filterMap(f) {
|
|
506
|
+
return (fa) => {
|
|
507
|
+
return filterMapWithIndex_1((_, a) => f(a))(fa);
|
|
508
|
+
};
|
|
580
509
|
}
|
|
581
510
|
function partitionWithIndex_1(predicate) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
511
|
+
return (fa) => {
|
|
512
|
+
return [filterWithIndex_1((i, a) => !predicate(i, a))(fa), filterWithIndex_1(predicate)(fa)];
|
|
513
|
+
};
|
|
585
514
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
515
|
+
function partition(predicate) {
|
|
516
|
+
return (fa) => {
|
|
517
|
+
return partitionWithIndex_1((_, a) => predicate(a))(fa);
|
|
518
|
+
};
|
|
590
519
|
}
|
|
591
520
|
/**
|
|
592
|
-
|
|
593
|
-
|
|
521
|
+
* @tsplus pipeable fncts.observable.Observable partitionMapWithIndex
|
|
522
|
+
*/
|
|
594
523
|
function partitionMapWithIndex_1(f) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
|
|
631
|
-
*/
|
|
524
|
+
return (fa) => {
|
|
525
|
+
return [new Observable((subscriber, environment) => {
|
|
526
|
+
let index = 0;
|
|
527
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
528
|
+
tsplus_module_14.match((b) => subscriber.next(b), tsplus_module_2.noop)(f(index++, value));
|
|
529
|
+
} })(subscriber));
|
|
530
|
+
}), new Observable((subscriber, environment) => {
|
|
531
|
+
let index = 0;
|
|
532
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
533
|
+
tsplus_module_14.match(tsplus_module_2.noop, (c) => subscriber.next(c))(f(index++, value));
|
|
534
|
+
} })(subscriber));
|
|
535
|
+
})];
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* @tsplus pipeable fncts.observable.Observable partitionMap
|
|
540
|
+
*/
|
|
541
|
+
function partitionMap(f) {
|
|
542
|
+
return (fa) => {
|
|
543
|
+
return partitionMapWithIndex_1((_, a) => f(a))(fa);
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* @tsplus pipeable fncts.observable.Observable provideService
|
|
548
|
+
*/
|
|
549
|
+
function provideService(service, tag) {
|
|
550
|
+
return (self) => {
|
|
551
|
+
return contramapEnvironment_1((environment) => tsplus_module_16.add(service, tag)(environment))(self);
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
|
|
556
|
+
*/
|
|
632
557
|
function mergeMapWithIndex_1(f, concurrent = Infinity) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
558
|
+
return (ma) => {
|
|
559
|
+
return new Observable((subscriber, environment) => {
|
|
560
|
+
return mergeInternal(ma, subscriber, environment, f, concurrent);
|
|
561
|
+
});
|
|
562
|
+
};
|
|
638
563
|
}
|
|
639
564
|
/**
|
|
640
|
-
|
|
641
|
-
|
|
565
|
+
* @tsplus pipeable fncts.observable.Observable mergeMap
|
|
566
|
+
*/
|
|
642
567
|
function mergeMap_1(f, concurrent = Infinity) {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
568
|
+
return (ma) => {
|
|
569
|
+
return mergeMapWithIndex_1((_, a) => f(a), concurrent)(ma);
|
|
570
|
+
};
|
|
646
571
|
}
|
|
647
572
|
/**
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
573
|
+
* @tsplus pipeable fncts.observable.Observable concatMapWithIndex
|
|
574
|
+
*/
|
|
575
|
+
function concatMapWithIndex(f) {
|
|
576
|
+
return (ma) => {
|
|
577
|
+
return mergeMapWithIndex_1(f, 1)(ma);
|
|
578
|
+
};
|
|
654
579
|
}
|
|
655
580
|
/**
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
581
|
+
* @tsplus pipeable fncts.observable.Observable concatMap
|
|
582
|
+
*/
|
|
583
|
+
function concatMap(f) {
|
|
584
|
+
return (ma) => {
|
|
585
|
+
return mergeMapWithIndex_1((_, a) => f(a), 1)(ma);
|
|
586
|
+
};
|
|
662
587
|
}
|
|
663
588
|
/**
|
|
664
|
-
|
|
665
|
-
|
|
589
|
+
* @tsplus pipeable fncts.observable.Observable contramapEnvironment
|
|
590
|
+
*/
|
|
666
591
|
function contramapEnvironment_1(f) {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
592
|
+
return (self) => {
|
|
593
|
+
return environmentWithObservable_1((environment) => self.provideEnvironment(f(environment)));
|
|
594
|
+
};
|
|
670
595
|
}
|
|
671
596
|
/**
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
597
|
+
* @tsplus getter fncts.observable.Observable flatten
|
|
598
|
+
*/
|
|
599
|
+
function flatten(mma) {
|
|
600
|
+
return concatAll_1(mma);
|
|
676
601
|
}
|
|
677
602
|
/**
|
|
678
|
-
|
|
679
|
-
|
|
603
|
+
* @tsplus pipeable fncts.observable.Observable foldLeftWithIndex
|
|
604
|
+
*/
|
|
680
605
|
function foldLeftWithIndex_1(initial, f) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
606
|
+
return (fa) => {
|
|
607
|
+
return new Observable((subscriber, environment) => {
|
|
608
|
+
return scanInternal(fa, subscriber, environment, f, initial, true, false, true);
|
|
609
|
+
});
|
|
610
|
+
};
|
|
686
611
|
}
|
|
687
612
|
/**
|
|
688
|
-
|
|
689
|
-
|
|
613
|
+
* @tsplus pipeable fncts.observable.Observable foldLeft
|
|
614
|
+
*/
|
|
690
615
|
function foldLeft_1(initial, f) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
616
|
+
return (fa) => {
|
|
617
|
+
return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
618
|
+
};
|
|
694
619
|
}
|
|
695
620
|
/**
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
621
|
+
* @tsplus pipeable fncts.observable.Observable at
|
|
622
|
+
*/
|
|
623
|
+
function at(index) {
|
|
624
|
+
return (fa) => {
|
|
625
|
+
return onEmpty_1(() => tsplus_module_17.nothing(fileName_1 + ":849:29"))(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1((i) => i === index)(fa))));
|
|
626
|
+
};
|
|
702
627
|
}
|
|
703
628
|
/**
|
|
704
|
-
|
|
705
|
-
|
|
629
|
+
* @tsplus pipeable fncts.observable.Observable audit
|
|
630
|
+
*/
|
|
706
631
|
function audit_1(durationSelector) {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
let buffer = null;
|
|
940
|
-
let closingSubscriber = null;
|
|
941
|
-
const openBuffer = () => {
|
|
942
|
-
closingSubscriber?.unsubscribe();
|
|
943
|
-
const b = buffer;
|
|
944
|
-
buffer = [];
|
|
945
|
-
b && subscriber.next(b);
|
|
946
|
-
from_1(closingSelector()).provideEnvironment(environment).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
947
|
-
next: openBuffer,
|
|
948
|
-
complete: tsplus_module_2.noop
|
|
949
|
-
}));
|
|
950
|
-
};
|
|
951
|
-
openBuffer();
|
|
952
|
-
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
953
|
-
next: value => buffer?.push(value),
|
|
954
|
-
complete: () => {
|
|
955
|
-
buffer && subscriber.next(buffer);
|
|
956
|
-
subscriber.complete();
|
|
957
|
-
},
|
|
958
|
-
finalize: () => buffer = closingSubscriber = null
|
|
959
|
-
})(subscriber));
|
|
960
|
-
});
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* @tsplus pipeable fncts.observable.Observable catchAllCause
|
|
965
|
-
*/
|
|
632
|
+
return (fa) => {
|
|
633
|
+
return new Observable((subscriber, environment) => {
|
|
634
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":859:40");
|
|
635
|
+
let durationSubscriber = null;
|
|
636
|
+
let isComplete = false;
|
|
637
|
+
const endDuration = () => {
|
|
638
|
+
durationSubscriber?.unsubscribe();
|
|
639
|
+
durationSubscriber = null;
|
|
640
|
+
if (tsplus_module_18.isJust(lastValue)) {
|
|
641
|
+
const { value } = lastValue;
|
|
642
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":867:36");
|
|
643
|
+
subscriber.next(value);
|
|
644
|
+
}
|
|
645
|
+
isComplete && subscriber.complete();
|
|
646
|
+
};
|
|
647
|
+
const cleanupDuration = () => {
|
|
648
|
+
durationSubscriber = null;
|
|
649
|
+
isComplete && subscriber.complete();
|
|
650
|
+
};
|
|
651
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
652
|
+
next: (value) => {
|
|
653
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":879:29");
|
|
654
|
+
if (!durationSubscriber) from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
655
|
+
next: endDuration,
|
|
656
|
+
complete: cleanupDuration
|
|
657
|
+
}));
|
|
658
|
+
},
|
|
659
|
+
complete: () => {
|
|
660
|
+
isComplete = true;
|
|
661
|
+
(tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber._closed) && subscriber.complete();
|
|
662
|
+
}
|
|
663
|
+
}));
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* @tsplus pipeable fncts.observable.Observable auditTime
|
|
669
|
+
*/
|
|
670
|
+
function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler) {
|
|
671
|
+
return (fa) => {
|
|
672
|
+
return audit_1(() => timer_1(duration, scheduler))(fa);
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* @tsplus pipeable fncts.observable.Observable buffer
|
|
677
|
+
*/
|
|
678
|
+
function buffer(closingNotifier) {
|
|
679
|
+
return (fa) => {
|
|
680
|
+
return new Observable((subscriber, environment) => {
|
|
681
|
+
let buffer = [];
|
|
682
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
683
|
+
next: (value) => buffer.push(value),
|
|
684
|
+
complete: () => {
|
|
685
|
+
subscriber.next(buffer);
|
|
686
|
+
subscriber.complete();
|
|
687
|
+
}
|
|
688
|
+
})(subscriber));
|
|
689
|
+
closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
690
|
+
next: () => {
|
|
691
|
+
const b = buffer;
|
|
692
|
+
buffer = [];
|
|
693
|
+
subscriber.next(b);
|
|
694
|
+
},
|
|
695
|
+
complete: tsplus_module_2.noop
|
|
696
|
+
})(subscriber));
|
|
697
|
+
return () => {
|
|
698
|
+
buffer = null;
|
|
699
|
+
};
|
|
700
|
+
});
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* @tsplus pipeable fncts.observable.Observable bufferCount
|
|
705
|
+
*/
|
|
706
|
+
function bufferCount(bufferSize, startBufferEvery) {
|
|
707
|
+
return (fa) => {
|
|
708
|
+
startBufferEvery = startBufferEvery ?? bufferSize;
|
|
709
|
+
return new Observable((subscriber, environment) => {
|
|
710
|
+
let buffers = [];
|
|
711
|
+
let count = 0;
|
|
712
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
713
|
+
next: (value) => {
|
|
714
|
+
let toEmit = null;
|
|
715
|
+
if (count++ % startBufferEvery === 0) buffers.push([]);
|
|
716
|
+
for (const buffer of buffers) {
|
|
717
|
+
buffer.push(value);
|
|
718
|
+
if (bufferSize <= buffer.length) {
|
|
719
|
+
toEmit = toEmit ?? [];
|
|
720
|
+
toEmit.push(buffer);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
if (toEmit) for (const buffer of toEmit) {
|
|
724
|
+
arrayRemove(buffers, buffer);
|
|
725
|
+
subscriber.next(buffer);
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
complete: () => {
|
|
729
|
+
for (const buffer of buffers) subscriber.next(buffer);
|
|
730
|
+
subscriber.complete();
|
|
731
|
+
},
|
|
732
|
+
finalize: () => {
|
|
733
|
+
buffers = null;
|
|
734
|
+
}
|
|
735
|
+
})(subscriber));
|
|
736
|
+
});
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* @tsplus pipeable fncts.observable.Observable bufferTime
|
|
741
|
+
*/
|
|
742
|
+
function bufferTime(config) {
|
|
743
|
+
return (fa) => {
|
|
744
|
+
const { bufferTimeSpan, bufferCreationInterval = null, maxBufferSize = Infinity, scheduler = tsplus_module_5.asyncScheduler } = config;
|
|
745
|
+
return new Observable((subscriber, environment) => {
|
|
746
|
+
let bufferRecords = [];
|
|
747
|
+
let restartOnEmit = true;
|
|
748
|
+
const emit = (record) => {
|
|
749
|
+
const { buffer, subs } = record;
|
|
750
|
+
subs.unsubscribe();
|
|
751
|
+
arrayRemove(bufferRecords, record);
|
|
752
|
+
subscriber.next(buffer);
|
|
753
|
+
restartOnEmit && startBuffer();
|
|
754
|
+
};
|
|
755
|
+
const startBuffer = () => {
|
|
756
|
+
if (bufferRecords) {
|
|
757
|
+
const subs = new tsplus_module_6.Subscription();
|
|
758
|
+
subscriber.add(subs);
|
|
759
|
+
const record = {
|
|
760
|
+
buffer: [],
|
|
761
|
+
subs
|
|
762
|
+
};
|
|
763
|
+
bufferRecords.push(record);
|
|
764
|
+
subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function() {
|
|
768
|
+
startBuffer();
|
|
769
|
+
!this._closed && subscriber.add(this.schedule(null, bufferCreationInterval));
|
|
770
|
+
}, bufferCreationInterval)) : restartOnEmit = true;
|
|
771
|
+
startBuffer();
|
|
772
|
+
const bufferTimeSubscriber = tsplus_module_8.operate_({
|
|
773
|
+
next: (value) => {
|
|
774
|
+
const recordsCopy = bufferRecords.slice();
|
|
775
|
+
for (const record of recordsCopy) {
|
|
776
|
+
const { buffer } = record;
|
|
777
|
+
buffer.push(value);
|
|
778
|
+
maxBufferSize <= buffer.length && emit(record);
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
complete: () => {
|
|
782
|
+
while (bufferRecords?.length) subscriber.next(bufferRecords.shift().buffer);
|
|
783
|
+
bufferTimeSubscriber?.unsubscribe();
|
|
784
|
+
subscriber.complete();
|
|
785
|
+
subscriber.unsubscribe();
|
|
786
|
+
},
|
|
787
|
+
finalize: () => {
|
|
788
|
+
bufferRecords = null;
|
|
789
|
+
}
|
|
790
|
+
})(subscriber);
|
|
791
|
+
return fa.provideEnvironment(environment).subscribe(bufferTimeSubscriber);
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* @tsplus pipeable fncts.observable.Observable bufferToggle
|
|
797
|
+
*/
|
|
798
|
+
function bufferToggle(openings, closingSelector) {
|
|
799
|
+
return (fa) => {
|
|
800
|
+
return new Observable((subscriber, environment) => {
|
|
801
|
+
const buffers = [];
|
|
802
|
+
from_1(openings).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
803
|
+
next: (openValue) => {
|
|
804
|
+
const buffer = [];
|
|
805
|
+
buffers.push(buffer);
|
|
806
|
+
const closingSubscription = new tsplus_module_6.Subscription();
|
|
807
|
+
const emitBuffer = () => {
|
|
808
|
+
arrayRemove(buffers, buffer);
|
|
809
|
+
subscriber.next(buffer);
|
|
810
|
+
closingSubscription.unsubscribe();
|
|
811
|
+
};
|
|
812
|
+
closingSubscription.add(from_1(closingSelector(openValue)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
813
|
+
next: emitBuffer,
|
|
814
|
+
complete: tsplus_module_2.noop
|
|
815
|
+
})));
|
|
816
|
+
},
|
|
817
|
+
complete: tsplus_module_2.noop
|
|
818
|
+
}));
|
|
819
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
820
|
+
next: (value) => {
|
|
821
|
+
for (const buffer of buffers) buffer.push(value);
|
|
822
|
+
},
|
|
823
|
+
complete: () => {
|
|
824
|
+
while (buffers.length > 0) subscriber.next(buffers.shift());
|
|
825
|
+
subscriber.complete();
|
|
826
|
+
}
|
|
827
|
+
})(subscriber));
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* @tsplus pipeable fncts.observable.Observable bufferWhen
|
|
833
|
+
*/
|
|
834
|
+
function bufferWhen(closingSelector) {
|
|
835
|
+
return (fa) => {
|
|
836
|
+
return new Observable((subscriber, environment) => {
|
|
837
|
+
let buffer = null;
|
|
838
|
+
let closingSubscriber = null;
|
|
839
|
+
const openBuffer = () => {
|
|
840
|
+
closingSubscriber?.unsubscribe();
|
|
841
|
+
const b = buffer;
|
|
842
|
+
buffer = [];
|
|
843
|
+
b && subscriber.next(b);
|
|
844
|
+
from_1(closingSelector()).provideEnvironment(environment).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
845
|
+
next: openBuffer,
|
|
846
|
+
complete: tsplus_module_2.noop
|
|
847
|
+
}));
|
|
848
|
+
};
|
|
849
|
+
openBuffer();
|
|
850
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
851
|
+
next: (value) => buffer?.push(value),
|
|
852
|
+
complete: () => {
|
|
853
|
+
buffer && subscriber.next(buffer);
|
|
854
|
+
subscriber.complete();
|
|
855
|
+
},
|
|
856
|
+
finalize: () => buffer = closingSubscriber = null
|
|
857
|
+
})(subscriber));
|
|
858
|
+
});
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* @tsplus pipeable fncts.observable.Observable catchAllCause
|
|
863
|
+
*/
|
|
966
864
|
function catchAllCause_1(f) {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* @tsplus getter fncts.observable.Observable concatAll
|
|
994
|
-
*/
|
|
865
|
+
return (self) => {
|
|
866
|
+
return new Observable((subscriber, environment) => {
|
|
867
|
+
let innerSub = null;
|
|
868
|
+
let syncUnsub = false;
|
|
869
|
+
let handledResult;
|
|
870
|
+
innerSub = self.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ error: (cause) => {
|
|
871
|
+
handledResult = from_1(f(cause, catchAllCause_1(f)(self)));
|
|
872
|
+
if (innerSub) {
|
|
873
|
+
innerSub.unsubscribe();
|
|
874
|
+
innerSub = null;
|
|
875
|
+
handledResult.provideEnvironment(environment).subscribe(subscriber);
|
|
876
|
+
} else syncUnsub = true;
|
|
877
|
+
} })(subscriber));
|
|
878
|
+
if (syncUnsub) {
|
|
879
|
+
innerSub.unsubscribe();
|
|
880
|
+
innerSub = null;
|
|
881
|
+
handledResult.provideEnvironment(environment).subscribe(subscriber);
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* @tsplus getter fncts.observable.Observable concatAll
|
|
888
|
+
*/
|
|
995
889
|
function concatAll_1(ffa) {
|
|
996
|
-
|
|
890
|
+
return mergeAll_1(1)(ffa);
|
|
997
891
|
}
|
|
998
892
|
/**
|
|
999
|
-
|
|
1000
|
-
|
|
893
|
+
* @tsplus pipeable fncts.observable.Observable concat
|
|
894
|
+
*/
|
|
1001
895
|
function concat_1(...sources) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
896
|
+
return (fa) => {
|
|
897
|
+
return new Observable((subscriber, environment) => {
|
|
898
|
+
return concatAll_1(fromArrayLike([fa, ...sources])).provideEnvironment(environment).subscribe(subscriber);
|
|
899
|
+
});
|
|
900
|
+
};
|
|
1007
901
|
}
|
|
1008
902
|
/**
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
903
|
+
* @tsplus getter fncts.observable.Observable count
|
|
904
|
+
*/
|
|
905
|
+
function count(fa) {
|
|
906
|
+
return foldLeft_1(0, (total, _) => total + 1)(fa);
|
|
1013
907
|
}
|
|
1014
908
|
/**
|
|
1015
|
-
|
|
1016
|
-
|
|
909
|
+
* @tsplus pipeable fncts.observable.Observable countWithIndex
|
|
910
|
+
*/
|
|
1017
911
|
function countWithIndex_1(predicate) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
912
|
+
return (fa) => {
|
|
913
|
+
return foldLeftWithIndex_1(0, (i, total, v) => predicate(i, v) ? total + 1 : total)(fa);
|
|
914
|
+
};
|
|
1021
915
|
}
|
|
1022
916
|
/**
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
917
|
+
* @tsplus pipeable fncts.observable.Observable countWith
|
|
918
|
+
*/
|
|
919
|
+
function countWith(predicate) {
|
|
920
|
+
return (fa) => {
|
|
921
|
+
return countWithIndex_1((_, a) => predicate(a))(fa);
|
|
922
|
+
};
|
|
1029
923
|
}
|
|
1030
924
|
/**
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
925
|
+
* @tsplus getter fncts.observable.Observable combineLatestAll
|
|
926
|
+
*/
|
|
927
|
+
function combineLatestAll(fa) {
|
|
928
|
+
return joinAllInternal(fa, (sources) => !sources.length ? empty_1() : zipLatest_1(sources[0], ...sources.slice(1)));
|
|
1035
929
|
}
|
|
1036
930
|
/**
|
|
1037
|
-
|
|
1038
|
-
|
|
931
|
+
* @tsplus pipeable fncts.observable.Observable zipLatest
|
|
932
|
+
*/
|
|
1039
933
|
function zipLatest_1(...sources) {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* @tsplus pipeable fncts.observable.Observable delayWithIndex
|
|
1162
|
-
*/
|
|
934
|
+
return (self) => {
|
|
935
|
+
if (!sources.length) return from_1(self);
|
|
936
|
+
return new Observable((subscriber, environment) => {
|
|
937
|
+
return combineLatestInternal(subscriber, environment, [self, ...sources]);
|
|
938
|
+
});
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* @tsplus pipeable fncts.observable.Observable zipWithLatest
|
|
943
|
+
*/
|
|
944
|
+
function zipWithLatest(that, f) {
|
|
945
|
+
return (self) => {
|
|
946
|
+
return map_1(tsplus_module_13.tupled(f))(zipLatest_1(from_1(that))(self));
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* @tsplus pipeable fncts.observable.Observable debounceWith
|
|
951
|
+
*/
|
|
952
|
+
function debounceWith(durationSelector) {
|
|
953
|
+
return (fa) => {
|
|
954
|
+
return new Observable((subscriber, environment) => {
|
|
955
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":1294:40");
|
|
956
|
+
let durationSubscriber = null;
|
|
957
|
+
const emit = () => {
|
|
958
|
+
durationSubscriber?.unsubscribe();
|
|
959
|
+
durationSubscriber = null;
|
|
960
|
+
if (tsplus_module_18.isJust(lastValue)) {
|
|
961
|
+
const { value } = lastValue;
|
|
962
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":1301:36");
|
|
963
|
+
subscriber.next(value);
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
967
|
+
next: (value) => {
|
|
968
|
+
durationSubscriber?.unsubscribe();
|
|
969
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":1309:38");
|
|
970
|
+
durationSubscriber = tsplus_module_8.operate_({
|
|
971
|
+
next: emit,
|
|
972
|
+
complete: tsplus_module_2.noop
|
|
973
|
+
})(subscriber);
|
|
974
|
+
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber);
|
|
975
|
+
},
|
|
976
|
+
complete: () => {
|
|
977
|
+
emit();
|
|
978
|
+
subscriber.complete();
|
|
979
|
+
},
|
|
980
|
+
finalize: () => {
|
|
981
|
+
lastValue = durationSubscriber = null;
|
|
982
|
+
}
|
|
983
|
+
})(subscriber));
|
|
984
|
+
});
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* @tsplus pipeable fncts.observable.Observable debounce
|
|
989
|
+
*/
|
|
990
|
+
function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
991
|
+
return (fa) => {
|
|
992
|
+
return new Observable((subscriber, environment) => {
|
|
993
|
+
let activeTask = null;
|
|
994
|
+
let lastValue = null;
|
|
995
|
+
let lastTime = null;
|
|
996
|
+
const emit = () => {
|
|
997
|
+
if (activeTask) {
|
|
998
|
+
activeTask.unsubscribe();
|
|
999
|
+
activeTask = null;
|
|
1000
|
+
const value = lastValue;
|
|
1001
|
+
lastValue = null;
|
|
1002
|
+
subscriber.next(value);
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
function emitWhenIdle() {
|
|
1006
|
+
const targetTime = lastTime + dueTime;
|
|
1007
|
+
const now = scheduler.now();
|
|
1008
|
+
if (now < targetTime) {
|
|
1009
|
+
activeTask = this.schedule(void 0, targetTime - now);
|
|
1010
|
+
subscriber.add(activeTask);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
emit();
|
|
1014
|
+
}
|
|
1015
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1016
|
+
next: (value) => {
|
|
1017
|
+
lastValue = value;
|
|
1018
|
+
lastTime = scheduler.now();
|
|
1019
|
+
if (!activeTask) {
|
|
1020
|
+
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1021
|
+
subscriber.add(activeTask);
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
complete: () => {
|
|
1025
|
+
emit();
|
|
1026
|
+
subscriber.complete();
|
|
1027
|
+
},
|
|
1028
|
+
finalize: () => {
|
|
1029
|
+
lastValue = activeTask = null;
|
|
1030
|
+
}
|
|
1031
|
+
})(subscriber));
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* @tsplus getter fncts.observable.Observable either
|
|
1037
|
+
*/
|
|
1038
|
+
function either(fa) {
|
|
1039
|
+
return new Observable((subscriber, environment) => {
|
|
1040
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1041
|
+
next: (value) => {
|
|
1042
|
+
subscriber.next(tsplus_module_19.right(value, fileName_1 + ":1385:39"));
|
|
1043
|
+
},
|
|
1044
|
+
error: (error) => {
|
|
1045
|
+
tsplus_module_14.match((e) => subscriber.next(tsplus_module_19.left(e, fileName_1 + ":1389:47")), (cause) => subscriber.error(cause))(tsplus_module_1.failureOrCause(error));
|
|
1046
|
+
}
|
|
1047
|
+
})(subscriber));
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* @tsplus pipeable fncts.observable.Observable delayWithIndex
|
|
1052
|
+
*/
|
|
1163
1053
|
function delayWithIndex_1(f) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1054
|
+
return (fa) => {
|
|
1055
|
+
return mergeMapWithIndex_1((i, a) => as_1(() => a)(take_1(1)(f(i, a))))(fa);
|
|
1056
|
+
};
|
|
1167
1057
|
}
|
|
1168
1058
|
/**
|
|
1169
|
-
|
|
1170
|
-
|
|
1059
|
+
* @tsplus pipeable fncts.observable.Observable delayWith
|
|
1060
|
+
*/
|
|
1171
1061
|
function delayWith_1(f) {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}));
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
|
|
1233
|
-
*/
|
|
1062
|
+
return (fa) => {
|
|
1063
|
+
return delayWithIndex_1((_, a) => f(a))(fa);
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* @tsplus pipeable fncts.observable.Observable delay
|
|
1068
|
+
*/
|
|
1069
|
+
function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1070
|
+
return (fa) => {
|
|
1071
|
+
const duration = timer_1(due, scheduler);
|
|
1072
|
+
return delayWith_1(() => duration)(fa);
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* @tsplus getter fncts.observable.Observable dematerialize
|
|
1077
|
+
*/
|
|
1078
|
+
function dematerialize(fa) {
|
|
1079
|
+
return new Observable((subscriber, environment) => {
|
|
1080
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (notification) => tsplus_module_20.observe(subscriber)(notification) })(subscriber));
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* @tsplus pipeable fncts.observable.Observable ensuring
|
|
1085
|
+
*/
|
|
1086
|
+
function ensuring(finalizer) {
|
|
1087
|
+
return (fa) => {
|
|
1088
|
+
return new Observable((subscriber, environment) => {
|
|
1089
|
+
subscriber.add(finalizer);
|
|
1090
|
+
return fa.provideEnvironment(environment).subscribe(subscriber);
|
|
1091
|
+
});
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* @tsplus getter fncts.observable.Observable exhaustAll
|
|
1096
|
+
*/
|
|
1097
|
+
function exhaustAll(ffa) {
|
|
1098
|
+
return new Observable((subscriber, environment) => {
|
|
1099
|
+
let isComplete = false;
|
|
1100
|
+
let innerSub = null;
|
|
1101
|
+
return ffa.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1102
|
+
next: (inner) => {
|
|
1103
|
+
if (!innerSub) innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ complete: () => {
|
|
1104
|
+
innerSub = null;
|
|
1105
|
+
isComplete && subscriber.complete();
|
|
1106
|
+
} })(subscriber));
|
|
1107
|
+
},
|
|
1108
|
+
complete: () => {
|
|
1109
|
+
isComplete = true;
|
|
1110
|
+
!innerSub && subscriber.complete();
|
|
1111
|
+
}
|
|
1112
|
+
}));
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
|
|
1117
|
+
*/
|
|
1234
1118
|
function exhaustMapWithIndex_1(f) {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
* @tsplus pipeable fncts.observable.Observable expandWithIndex
|
|
1270
|
-
*/
|
|
1119
|
+
return (self) => {
|
|
1120
|
+
return new Observable((subscriber, environment) => {
|
|
1121
|
+
let index = 0;
|
|
1122
|
+
let innerSub = null;
|
|
1123
|
+
let isComplete = false;
|
|
1124
|
+
self.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1125
|
+
next: (outerValue) => {
|
|
1126
|
+
if (!innerSub) {
|
|
1127
|
+
innerSub = tsplus_module_8.operate_({ complete: () => {
|
|
1128
|
+
innerSub = null;
|
|
1129
|
+
isComplete && subscriber.complete();
|
|
1130
|
+
} })(subscriber);
|
|
1131
|
+
from_1(f(index++, outerValue)).provideEnvironment(environment).subscribe(innerSub);
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
complete: () => {
|
|
1135
|
+
isComplete = true;
|
|
1136
|
+
!innerSub && subscriber.complete();
|
|
1137
|
+
}
|
|
1138
|
+
})(subscriber));
|
|
1139
|
+
});
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* @tsplus pipeable fncts.observable.Observable exhaustMap
|
|
1144
|
+
*/
|
|
1145
|
+
function exhaustMap(f) {
|
|
1146
|
+
return (self) => {
|
|
1147
|
+
return exhaustMapWithIndex_1((_, a) => f(a))(self);
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* @tsplus pipeable fncts.observable.Observable expandWithIndex
|
|
1152
|
+
*/
|
|
1271
1153
|
function expandWithIndex_1(f, concurrent = Infinity) {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1154
|
+
return (fa) => {
|
|
1155
|
+
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
|
1156
|
+
return new Observable((subscriber, environment) => {
|
|
1157
|
+
return mergeInternal(fa, subscriber, environment, f, concurrent, void 0, true);
|
|
1158
|
+
});
|
|
1159
|
+
};
|
|
1278
1160
|
}
|
|
1279
1161
|
/**
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1162
|
+
* @tsplus pipeable fncts.observable.Observable expand
|
|
1163
|
+
*/
|
|
1164
|
+
function expand(f, concurrent = Infinity) {
|
|
1165
|
+
return (fa) => {
|
|
1166
|
+
return expandWithIndex_1((_, a) => f(a), concurrent)(fa);
|
|
1167
|
+
};
|
|
1286
1168
|
}
|
|
1287
1169
|
function findWithIndex_1(predicate) {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1170
|
+
return (fa) => {
|
|
1171
|
+
return new Observable(findInternal(fa, predicate, "value"));
|
|
1172
|
+
};
|
|
1291
1173
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1174
|
+
function find(predicate) {
|
|
1175
|
+
return (fa) => {
|
|
1176
|
+
return findWithIndex_1((_, a) => predicate(a))(fa);
|
|
1177
|
+
};
|
|
1296
1178
|
}
|
|
1297
1179
|
function findIndexWithIndex_1(predicate) {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
subscriber.next(tsplus_module_20.complete());
|
|
1388
|
-
}
|
|
1389
|
-
})(subscriber));
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
/**
|
|
1393
|
-
* @tsplus pipeable fncts.observable.Observable mergeAll
|
|
1394
|
-
*/
|
|
1180
|
+
return (fa) => {
|
|
1181
|
+
return new Observable(findInternal(fa, predicate, "index"));
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function findIndex(predicate) {
|
|
1185
|
+
return (fa) => {
|
|
1186
|
+
return findIndexWithIndex_1((_, a) => predicate(a))(fa);
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
function forkJoin(...args) {
|
|
1190
|
+
const { args: sources, keys } = arrayOrObject(args);
|
|
1191
|
+
return new Observable((s, environment) => {
|
|
1192
|
+
const length = sources.length;
|
|
1193
|
+
if (!length) {
|
|
1194
|
+
s.complete();
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
const values = new Array(length);
|
|
1198
|
+
let remainingCompletions = length;
|
|
1199
|
+
let remainingEmissions = length;
|
|
1200
|
+
for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
|
|
1201
|
+
let hasValue = false;
|
|
1202
|
+
from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1203
|
+
next: (value) => {
|
|
1204
|
+
if (!hasValue) {
|
|
1205
|
+
hasValue = true;
|
|
1206
|
+
remainingEmissions--;
|
|
1207
|
+
}
|
|
1208
|
+
values[sourceIndex] = value;
|
|
1209
|
+
},
|
|
1210
|
+
complete: () => {
|
|
1211
|
+
if (!--remainingCompletions || !hasValue) {
|
|
1212
|
+
if (!remainingEmissions) s.next(keys ? keys.reduce((b, k, i) => {
|
|
1213
|
+
b[k] = values[i];
|
|
1214
|
+
return b;
|
|
1215
|
+
}, {}) : values);
|
|
1216
|
+
s.complete();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
})(s));
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* @tsplus getter fncts.observable.Observable ignore
|
|
1225
|
+
*/
|
|
1226
|
+
function ignore(fa) {
|
|
1227
|
+
return new Observable((subscriber, environment) => {
|
|
1228
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: tsplus_module_2.noop })(subscriber));
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* @tsplus getter fncts.observable.Observable isEmpty
|
|
1233
|
+
*/
|
|
1234
|
+
function isEmpty(fa) {
|
|
1235
|
+
return new Observable((subscriber, environment) => {
|
|
1236
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1237
|
+
next: () => {
|
|
1238
|
+
subscriber.next(false);
|
|
1239
|
+
subscriber.complete();
|
|
1240
|
+
},
|
|
1241
|
+
complete: () => {
|
|
1242
|
+
subscriber.next(true);
|
|
1243
|
+
subscriber.complete();
|
|
1244
|
+
}
|
|
1245
|
+
})(subscriber));
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* @tsplus getter fncts.observable.Observable materialize
|
|
1250
|
+
*/
|
|
1251
|
+
function materialize(fa) {
|
|
1252
|
+
return new Observable((subscriber, environment) => {
|
|
1253
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1254
|
+
next: (value) => {
|
|
1255
|
+
subscriber.next(tsplus_module_20.next(value));
|
|
1256
|
+
},
|
|
1257
|
+
error: (error) => {
|
|
1258
|
+
subscriber.next(tsplus_module_20.error(error));
|
|
1259
|
+
},
|
|
1260
|
+
complete: () => {
|
|
1261
|
+
subscriber.next(tsplus_module_20.complete());
|
|
1262
|
+
}
|
|
1263
|
+
})(subscriber));
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* @tsplus pipeable fncts.observable.Observable mergeAll
|
|
1268
|
+
*/
|
|
1395
1269
|
function mergeAll_1(concurrent = Infinity) {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1270
|
+
return (self) => {
|
|
1271
|
+
return mergeMap_1(tsplus_module_13.identity, concurrent)(self);
|
|
1272
|
+
};
|
|
1399
1273
|
}
|
|
1400
1274
|
/**
|
|
1401
|
-
|
|
1402
|
-
|
|
1275
|
+
* @tsplus pipeable fncts.observable.Observable mergeScanWithIndex
|
|
1276
|
+
*/
|
|
1403
1277
|
function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1413
|
-
/**
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
}
|
|
1448
|
-
/**
|
|
1449
|
-
* @tsplus pipeable fncts.observable.Observable onEmpty
|
|
1450
|
-
*/
|
|
1278
|
+
return (fa) => {
|
|
1279
|
+
return new Observable((subscriber, environment) => {
|
|
1280
|
+
let state = initial;
|
|
1281
|
+
return mergeInternal(fa, subscriber, environment, (index, value) => f(index, state, value), concurrent, (value) => {
|
|
1282
|
+
state = value;
|
|
1283
|
+
}, false, void 0, () => state = null);
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* @tsplus pipeable fncts.observable.Observable mergeScan
|
|
1289
|
+
*/
|
|
1290
|
+
function mergeScan(initial, f, concurrent = Infinity) {
|
|
1291
|
+
return (fa) => {
|
|
1292
|
+
return mergeScanWithIndex_1(initial, (_, b, a) => f(b, a), concurrent)(fa);
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
function onErrorResumeNext(fa, ...sources) {
|
|
1296
|
+
return new Observable((subscriber, environment) => {
|
|
1297
|
+
const remaining = [fa, ...sources];
|
|
1298
|
+
const subscribeNext = () => {
|
|
1299
|
+
if (!subscriber._closed) if (remaining.length > 0) {
|
|
1300
|
+
let nextSource;
|
|
1301
|
+
try {
|
|
1302
|
+
nextSource = from_1(remaining.shift());
|
|
1303
|
+
} catch (err) {
|
|
1304
|
+
subscribeNext();
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
const innerSub = tsplus_module_8.operate_({
|
|
1308
|
+
error: tsplus_module_2.noop,
|
|
1309
|
+
complete: tsplus_module_2.noop
|
|
1310
|
+
})(subscriber);
|
|
1311
|
+
subscriber.add(nextSource.provideEnvironment(environment).subscribe(innerSub));
|
|
1312
|
+
innerSub.add(subscribeNext);
|
|
1313
|
+
} else subscriber.complete();
|
|
1314
|
+
};
|
|
1315
|
+
subscribeNext();
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* @tsplus pipeable fncts.observable.Observable onEmpty
|
|
1320
|
+
*/
|
|
1451
1321
|
function onEmpty_1(f) {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
innerSub.unsubscribe();
|
|
1535
|
-
innerSub = null;
|
|
1536
|
-
loop();
|
|
1537
|
-
} else {
|
|
1538
|
-
syncUnsub = true;
|
|
1539
|
-
}
|
|
1540
|
-
} else {
|
|
1541
|
-
subscriber.error(err);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
})(subscriber));
|
|
1545
|
-
if (syncUnsub) {
|
|
1546
|
-
innerSub.unsubscribe();
|
|
1547
|
-
innerSub = null;
|
|
1548
|
-
loop();
|
|
1549
|
-
}
|
|
1550
|
-
};
|
|
1551
|
-
loop();
|
|
1552
|
-
});
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
/**
|
|
1556
|
-
* @tsplus pipeable fncts.observable.Observable sample
|
|
1557
|
-
*/
|
|
1322
|
+
return (fa) => {
|
|
1323
|
+
return new Observable((subscriber, environment) => {
|
|
1324
|
+
let hasValue = false;
|
|
1325
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1326
|
+
next: (value) => {
|
|
1327
|
+
hasValue = true;
|
|
1328
|
+
subscriber.next(value);
|
|
1329
|
+
},
|
|
1330
|
+
complete: () => {
|
|
1331
|
+
if (!hasValue) subscriber.next(f());
|
|
1332
|
+
subscriber.complete();
|
|
1333
|
+
}
|
|
1334
|
+
})(subscriber));
|
|
1335
|
+
});
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* @tsplus pipeable fncts.observable.Observable repeat
|
|
1340
|
+
*/
|
|
1341
|
+
function repeat(count = Infinity) {
|
|
1342
|
+
return (fa) => {
|
|
1343
|
+
return count <= 0 ? empty_1() : new Observable((subscriber, environment) => {
|
|
1344
|
+
let repeats = 0;
|
|
1345
|
+
let innerSub;
|
|
1346
|
+
const loop = () => {
|
|
1347
|
+
let syncUnsub = false;
|
|
1348
|
+
innerSub = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ complete: () => {
|
|
1349
|
+
if (++repeats < count) if (innerSub) {
|
|
1350
|
+
innerSub.unsubscribe();
|
|
1351
|
+
innerSub = null;
|
|
1352
|
+
loop();
|
|
1353
|
+
} else syncUnsub = true;
|
|
1354
|
+
else subscriber.complete;
|
|
1355
|
+
} })(subscriber));
|
|
1356
|
+
if (syncUnsub) {
|
|
1357
|
+
innerSub.unsubscribe();
|
|
1358
|
+
innerSub = null;
|
|
1359
|
+
loop();
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
loop();
|
|
1363
|
+
});
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function retry(configOrCount = Infinity) {
|
|
1367
|
+
return (fa) => {
|
|
1368
|
+
let config;
|
|
1369
|
+
if (configOrCount && typeof configOrCount === "object") config = configOrCount;
|
|
1370
|
+
else config = { count: configOrCount };
|
|
1371
|
+
const { count, resetOnSuccess = false } = config;
|
|
1372
|
+
return count <= 0 ? fa : new Observable((subscriber, environment) => {
|
|
1373
|
+
let retries = 0;
|
|
1374
|
+
let innerSub;
|
|
1375
|
+
const loop = () => {
|
|
1376
|
+
let syncUnsub = false;
|
|
1377
|
+
innerSub = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1378
|
+
next: (value) => {
|
|
1379
|
+
if (resetOnSuccess) retries = 0;
|
|
1380
|
+
subscriber.next(value);
|
|
1381
|
+
},
|
|
1382
|
+
error: (err) => {
|
|
1383
|
+
if (retries++ < count) if (innerSub) {
|
|
1384
|
+
innerSub.unsubscribe();
|
|
1385
|
+
innerSub = null;
|
|
1386
|
+
loop();
|
|
1387
|
+
} else syncUnsub = true;
|
|
1388
|
+
else subscriber.error(err);
|
|
1389
|
+
}
|
|
1390
|
+
})(subscriber));
|
|
1391
|
+
if (syncUnsub) {
|
|
1392
|
+
innerSub.unsubscribe();
|
|
1393
|
+
innerSub = null;
|
|
1394
|
+
loop();
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
loop();
|
|
1398
|
+
});
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* @tsplus pipeable fncts.observable.Observable sample
|
|
1403
|
+
*/
|
|
1558
1404
|
function sample_1(notifier) {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
* @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
|
|
1594
|
-
*/
|
|
1405
|
+
return (fa) => {
|
|
1406
|
+
return new Observable((subscriber, environment) => {
|
|
1407
|
+
let hasValue = false;
|
|
1408
|
+
let lastValue = null;
|
|
1409
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1410
|
+
hasValue = true;
|
|
1411
|
+
lastValue = value;
|
|
1412
|
+
} })(subscriber));
|
|
1413
|
+
const emit = () => {
|
|
1414
|
+
if (hasValue) {
|
|
1415
|
+
hasValue = false;
|
|
1416
|
+
const value = lastValue;
|
|
1417
|
+
lastValue = null;
|
|
1418
|
+
subscriber.next(value);
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1422
|
+
next: emit,
|
|
1423
|
+
complete: tsplus_module_2.noop
|
|
1424
|
+
})(subscriber));
|
|
1425
|
+
});
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* @tsplus pipeable fncts.observable.Observable sampleTime
|
|
1430
|
+
*/
|
|
1431
|
+
function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1432
|
+
return (fa) => {
|
|
1433
|
+
return sample_1(interval_1(period, scheduler))(fa);
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
|
|
1438
|
+
*/
|
|
1595
1439
|
function scanLeftWithIndex_1(initial, f) {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1600
|
-
/**
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
}
|
|
1614
|
-
/**
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
/**
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
function serviceWithObservable_1(f,
|
|
1624
|
-
|
|
1625
|
-
}
|
|
1626
|
-
/**
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
}
|
|
1634
|
-
/**
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
* @tsplus getter fncts.observable.Observable switchAll
|
|
1719
|
-
*/
|
|
1720
|
-
export function switchAll(ffa) {
|
|
1721
|
-
return switchMap_1(tsplus_module_13.identity)(ffa);
|
|
1722
|
-
}
|
|
1723
|
-
/**
|
|
1724
|
-
* @tsplus pipeable fncts.observable.Observable switchMapWithIndex
|
|
1725
|
-
*/
|
|
1440
|
+
return (fa) => {
|
|
1441
|
+
return new Observable((subscriber, environment) => scanInternal(fa, subscriber, environment, f, initial, true, true));
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* @tsplus pipeable fncts.observable.Observable scanLeft
|
|
1446
|
+
*/
|
|
1447
|
+
function scanLeft(initial, f) {
|
|
1448
|
+
return (fa) => {
|
|
1449
|
+
return scanLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* @tsplus static fncts.observable.ObservableOps service
|
|
1454
|
+
*/
|
|
1455
|
+
function service(tag) {
|
|
1456
|
+
return serviceWithObservable_1((service) => of_1(service), tag);
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* @tsplus static fncts.observable.ObservableOps serviceWith
|
|
1460
|
+
*/
|
|
1461
|
+
function serviceWith(f, tag) {
|
|
1462
|
+
return serviceWithObservable_1((service) => of_1(f(service)), tag);
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* @tsplus static fncts.observable.ObservableOps serviceWithObservable
|
|
1466
|
+
*/
|
|
1467
|
+
function serviceWithObservable_1(f, tag) {
|
|
1468
|
+
return environmentWithObservable_1((environment) => f(tsplus_module_16.unsafeGet(tag)(environment)));
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* @tsplus pipeable fncts.observable.Observable skip
|
|
1472
|
+
*/
|
|
1473
|
+
function skip(count) {
|
|
1474
|
+
return (fa) => {
|
|
1475
|
+
return filterWithIndex_1((index, _) => count <= index)(fa);
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* @tsplus pipeable fncts.observable.Observable skipLast
|
|
1480
|
+
*/
|
|
1481
|
+
function skipLast(skipCount) {
|
|
1482
|
+
return (fa) => {
|
|
1483
|
+
return skipCount <= 0 ? fa : new Observable((subscriber, environment) => {
|
|
1484
|
+
let ring = new Array(skipCount);
|
|
1485
|
+
let seen = 0;
|
|
1486
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1487
|
+
const valueIndex = seen++;
|
|
1488
|
+
if (valueIndex < skipCount) ring[valueIndex] = value;
|
|
1489
|
+
else {
|
|
1490
|
+
const index = valueIndex % skipCount;
|
|
1491
|
+
const oldValue = ring[index];
|
|
1492
|
+
ring[index] = value;
|
|
1493
|
+
subscriber.next(oldValue);
|
|
1494
|
+
}
|
|
1495
|
+
} })(subscriber));
|
|
1496
|
+
return () => {
|
|
1497
|
+
ring = null;
|
|
1498
|
+
};
|
|
1499
|
+
});
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* @tsplus pipeable fncts.observable.Observable skipUntil
|
|
1504
|
+
*/
|
|
1505
|
+
function skipUntil(notifier) {
|
|
1506
|
+
return (fa) => {
|
|
1507
|
+
return new Observable((subscriber, environment) => {
|
|
1508
|
+
let taking = false;
|
|
1509
|
+
const skipSubscriber = tsplus_module_8.operate_({
|
|
1510
|
+
next: () => {
|
|
1511
|
+
skipSubscriber?.unsubscribe();
|
|
1512
|
+
taking = true;
|
|
1513
|
+
},
|
|
1514
|
+
complete: tsplus_module_2.noop
|
|
1515
|
+
})(subscriber);
|
|
1516
|
+
from_1(notifier).provideEnvironment(environment).subscribe(skipSubscriber);
|
|
1517
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => taking && subscriber.next(value) })(subscriber));
|
|
1518
|
+
});
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* @tsplus pipeable fncts.observable.Observable skipWhile
|
|
1523
|
+
*/
|
|
1524
|
+
function skipWhile(predicate) {
|
|
1525
|
+
return (fa) => {
|
|
1526
|
+
return new Observable((subscriber, environment) => {
|
|
1527
|
+
let taking = false;
|
|
1528
|
+
let index = 0;
|
|
1529
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => (taking || (taking = !predicate(index++, value))) && subscriber.next(value) })(subscriber));
|
|
1530
|
+
});
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* @tsplus pipeable fncts.observable.Observable startWith
|
|
1535
|
+
*/
|
|
1536
|
+
function startWith(...values) {
|
|
1537
|
+
return (fa) => {
|
|
1538
|
+
return new Observable((subscriber, environment) => {
|
|
1539
|
+
return concat_1(values)(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
1540
|
+
});
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* @tsplus pipeable fncts.observable.Observable subscribeOn
|
|
1545
|
+
*/
|
|
1546
|
+
function subscribeOn(scheduler, delay = 0) {
|
|
1547
|
+
return (fa) => {
|
|
1548
|
+
return new Observable((subscriber, environment) => {
|
|
1549
|
+
subscriber.add(scheduler.schedule(() => fa.provideEnvironment(environment).subscribe(subscriber), delay));
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* @tsplus getter fncts.observable.Observable switchAll
|
|
1555
|
+
*/
|
|
1556
|
+
function switchAll(ffa) {
|
|
1557
|
+
return switchMap_1(tsplus_module_13.identity)(ffa);
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* @tsplus pipeable fncts.observable.Observable switchMapWithIndex
|
|
1561
|
+
*/
|
|
1726
1562
|
function switchMapWithIndex_1(f) {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
*/
|
|
1563
|
+
return (fa) => {
|
|
1564
|
+
return new Observable((destination, environment) => {
|
|
1565
|
+
let innerSubscriber = null;
|
|
1566
|
+
let index = 0;
|
|
1567
|
+
let isComplete = false;
|
|
1568
|
+
const checkComplete = () => isComplete && !innerSubscriber && destination.complete();
|
|
1569
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1570
|
+
next: (value) => {
|
|
1571
|
+
innerSubscriber?.unsubscribe();
|
|
1572
|
+
from_1(f(index++, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.operate_({
|
|
1573
|
+
next: (innerValue) => destination.next(innerValue),
|
|
1574
|
+
complete: () => {
|
|
1575
|
+
innerSubscriber = null;
|
|
1576
|
+
checkComplete();
|
|
1577
|
+
}
|
|
1578
|
+
})(destination));
|
|
1579
|
+
},
|
|
1580
|
+
complete: () => {
|
|
1581
|
+
isComplete = true;
|
|
1582
|
+
checkComplete();
|
|
1583
|
+
}
|
|
1584
|
+
})(destination));
|
|
1585
|
+
});
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* @tsplus pipeable fncts.observable.Observable switchMap
|
|
1590
|
+
*/
|
|
1756
1591
|
function switchMap_1(f) {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1592
|
+
return (fa) => {
|
|
1593
|
+
return switchMapWithIndex_1((_, a) => f(a))(fa);
|
|
1594
|
+
};
|
|
1760
1595
|
}
|
|
1761
1596
|
/**
|
|
1762
|
-
|
|
1763
|
-
|
|
1597
|
+
* @tsplus pipeable fncts.observable.Observable switchScanWithIndex
|
|
1598
|
+
*/
|
|
1764
1599
|
function switchScanWithIndex_1(initial, f) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
1775
|
-
/**
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
/**
|
|
1784
|
-
|
|
1785
|
-
|
|
1600
|
+
return (fa) => {
|
|
1601
|
+
return new Observable((subscriber, environment) => {
|
|
1602
|
+
let state = initial;
|
|
1603
|
+
switchMapWithIndex_1((index, value) => map_1((b) => (state = b, b))(from_1(f(index, state, value))))(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
1604
|
+
return () => {
|
|
1605
|
+
state = null;
|
|
1606
|
+
};
|
|
1607
|
+
});
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* @tsplus pipeable fncts.observable.Observable switchScan
|
|
1612
|
+
*/
|
|
1613
|
+
function switchScan(initial, f) {
|
|
1614
|
+
return (fa) => {
|
|
1615
|
+
return switchScanWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* @tsplus pipeable fncts.observable.Observable take
|
|
1620
|
+
*/
|
|
1786
1621
|
function take_1(count) {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
next: () => subscriber.complete(),
|
|
1836
|
-
complete: tsplus_module_2.noop
|
|
1837
|
-
})(subscriber));
|
|
1838
|
-
!subscriber._closed && fa.provideEnvironment(environment).subscribe(subscriber);
|
|
1839
|
-
});
|
|
1840
|
-
};
|
|
1622
|
+
return (fa) => {
|
|
1623
|
+
return count <= 0 ? empty_1() : new Observable((sub, environment) => {
|
|
1624
|
+
let seen = 0;
|
|
1625
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1626
|
+
if (++seen <= count) {
|
|
1627
|
+
sub.next(value);
|
|
1628
|
+
if (count <= seen) sub.complete();
|
|
1629
|
+
}
|
|
1630
|
+
} })(sub));
|
|
1631
|
+
});
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* @tsplus pipeable fncts.observable.Observable takeLast
|
|
1636
|
+
*/
|
|
1637
|
+
function takeLast(count) {
|
|
1638
|
+
return (fa) => {
|
|
1639
|
+
return count <= 0 ? empty_1() : new Observable((subscriber, environment) => {
|
|
1640
|
+
let buffer = [];
|
|
1641
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1642
|
+
next: (value) => {
|
|
1643
|
+
buffer.push(value);
|
|
1644
|
+
count < buffer.length && buffer.shift();
|
|
1645
|
+
},
|
|
1646
|
+
complete: () => {
|
|
1647
|
+
for (const value of buffer) subscriber.next(value);
|
|
1648
|
+
subscriber.complete();
|
|
1649
|
+
},
|
|
1650
|
+
finalize: () => {
|
|
1651
|
+
buffer = null;
|
|
1652
|
+
}
|
|
1653
|
+
})(subscriber));
|
|
1654
|
+
});
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* @tsplus pipeable fncts.observable.Observable takeUntil
|
|
1659
|
+
*/
|
|
1660
|
+
function takeUntil(notifier) {
|
|
1661
|
+
return (fa) => {
|
|
1662
|
+
return new Observable((subscriber, environment) => {
|
|
1663
|
+
from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1664
|
+
next: () => subscriber.complete(),
|
|
1665
|
+
complete: tsplus_module_2.noop
|
|
1666
|
+
})(subscriber));
|
|
1667
|
+
!subscriber._closed && fa.provideEnvironment(environment).subscribe(subscriber);
|
|
1668
|
+
});
|
|
1669
|
+
};
|
|
1841
1670
|
}
|
|
1842
1671
|
function takeWhileWithIndex_1(predicate, inclusive) {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
leading: true,
|
|
1886
|
-
trailing: false
|
|
1672
|
+
return (fa) => {
|
|
1673
|
+
return new Observable((subscriber, environment) => {
|
|
1674
|
+
let index = 0;
|
|
1675
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1676
|
+
const result = predicate(index++, value);
|
|
1677
|
+
(result || inclusive) && subscriber.next(value);
|
|
1678
|
+
!result && subscriber.complete();
|
|
1679
|
+
} })(subscriber));
|
|
1680
|
+
});
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
function takeWhile(predicate, inclusive) {
|
|
1684
|
+
return (fa) => {
|
|
1685
|
+
return takeWhileWithIndex_1((_, a) => predicate(a), inclusive)(fa);
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* @tsplus pipeable fncts.observable.Observable tap
|
|
1690
|
+
*/
|
|
1691
|
+
function tap(observer) {
|
|
1692
|
+
return (fa) => {
|
|
1693
|
+
return new Observable((subscriber, environment) => {
|
|
1694
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1695
|
+
next: (value) => {
|
|
1696
|
+
observer.next?.(value);
|
|
1697
|
+
subscriber.next(value);
|
|
1698
|
+
},
|
|
1699
|
+
error: (err) => {
|
|
1700
|
+
observer.error?.(err);
|
|
1701
|
+
subscriber.error(err);
|
|
1702
|
+
},
|
|
1703
|
+
complete: () => {
|
|
1704
|
+
observer.complete?.();
|
|
1705
|
+
subscriber.complete();
|
|
1706
|
+
}
|
|
1707
|
+
})(subscriber));
|
|
1708
|
+
});
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
const defaultThrottleConfig = {
|
|
1712
|
+
leading: true,
|
|
1713
|
+
trailing: false
|
|
1887
1714
|
};
|
|
1888
1715
|
/**
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
function throttle_1(durationSelector, {
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
lastValue = tsplus_module_17.just(value, fileName_1 + ":2506:29");
|
|
1986
|
-
subscriber.next(value);
|
|
1987
|
-
each > 0 && startTimer(each);
|
|
1988
|
-
},
|
|
1989
|
-
finalize: () => {
|
|
1990
|
-
if (!timerSubscription?._closed) {
|
|
1991
|
-
timerSubscription?.unsubscribe();
|
|
1992
|
-
}
|
|
1993
|
-
lastValue = tsplus_module_17.nothing(fileName_1 + ":2514:32");
|
|
1994
|
-
}
|
|
1995
|
-
})(subscriber));
|
|
1996
|
-
startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
1997
|
-
});
|
|
1998
|
-
};
|
|
1716
|
+
* @tsplus pipeable fncts.observable.Observable throttle
|
|
1717
|
+
*/
|
|
1718
|
+
function throttle_1(durationSelector, { leading, trailing } = defaultThrottleConfig) {
|
|
1719
|
+
return (fa) => {
|
|
1720
|
+
return new Observable((subscriber, environment) => {
|
|
1721
|
+
let sendValue = tsplus_module_17.nothing(fileName_1 + ":2369:51");
|
|
1722
|
+
let throttled = null;
|
|
1723
|
+
let isComplete = false;
|
|
1724
|
+
const endThrottling = () => {
|
|
1725
|
+
throttled?.unsubscribe();
|
|
1726
|
+
throttled = null;
|
|
1727
|
+
if (trailing) {
|
|
1728
|
+
send();
|
|
1729
|
+
isComplete && subscriber.complete();
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
const cleanupThrottling = () => {
|
|
1733
|
+
throttled = null;
|
|
1734
|
+
isComplete && subscriber.complete();
|
|
1735
|
+
};
|
|
1736
|
+
const startThrottling = (value) => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1737
|
+
next: endThrottling,
|
|
1738
|
+
complete: cleanupThrottling
|
|
1739
|
+
})(subscriber));
|
|
1740
|
+
const send = () => {
|
|
1741
|
+
if (tsplus_module_18.isJust(sendValue)) {
|
|
1742
|
+
const { value } = sendValue;
|
|
1743
|
+
sendValue = tsplus_module_17.nothing(fileName_1 + ":2391:36");
|
|
1744
|
+
subscriber.next(value);
|
|
1745
|
+
!isComplete && startThrottling(value);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1749
|
+
next: (value) => {
|
|
1750
|
+
sendValue = tsplus_module_17.just(value, fileName_1 + ":2399:29");
|
|
1751
|
+
!(throttled && !throttled._closed) && (leading ? send() : startThrottling(value));
|
|
1752
|
+
},
|
|
1753
|
+
complete: () => {
|
|
1754
|
+
isComplete = true;
|
|
1755
|
+
!(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled._closed) && subscriber.complete();
|
|
1756
|
+
}
|
|
1757
|
+
})(subscriber));
|
|
1758
|
+
});
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* @tsplus pipeable fncts.observable.Observable throttleTime
|
|
1763
|
+
*/
|
|
1764
|
+
function throttleTime(duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
|
|
1765
|
+
return (fa) => {
|
|
1766
|
+
const duration$ = timer_1(duration, scheduler);
|
|
1767
|
+
return throttle_1(() => duration$, config)(fa);
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
var TimeoutError = class extends Error {
|
|
1771
|
+
info;
|
|
1772
|
+
constructor(info) {
|
|
1773
|
+
super("Timeout has occurred");
|
|
1774
|
+
this.info = info;
|
|
1775
|
+
this.name = "TimeoutError";
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
function timeout(config) {
|
|
1779
|
+
return (fa) => {
|
|
1780
|
+
const { first, each, with: _with = timeoutError, scheduler = tsplus_module_5.asyncScheduler, meta = null } = config;
|
|
1781
|
+
return new Observable((subscriber, environment) => {
|
|
1782
|
+
let originalSourceSubscription;
|
|
1783
|
+
let timerSubscription;
|
|
1784
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":2480:40");
|
|
1785
|
+
let seen = 0;
|
|
1786
|
+
const startTimer = (delay) => {
|
|
1787
|
+
timerSubscription = caughtSchedule(subscriber, scheduler, () => {
|
|
1788
|
+
originalSourceSubscription.unsubscribe();
|
|
1789
|
+
from_1(_with({
|
|
1790
|
+
meta,
|
|
1791
|
+
lastValue,
|
|
1792
|
+
seen
|
|
1793
|
+
})).provideEnvironment(environment).subscribe(subscriber);
|
|
1794
|
+
}, delay);
|
|
1795
|
+
};
|
|
1796
|
+
originalSourceSubscription = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1797
|
+
next: (value) => {
|
|
1798
|
+
timerSubscription?.unsubscribe();
|
|
1799
|
+
seen++;
|
|
1800
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":2506:29");
|
|
1801
|
+
subscriber.next(value);
|
|
1802
|
+
each > 0 && startTimer(each);
|
|
1803
|
+
},
|
|
1804
|
+
finalize: () => {
|
|
1805
|
+
if (!timerSubscription?._closed) timerSubscription?.unsubscribe();
|
|
1806
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":2514:32");
|
|
1807
|
+
}
|
|
1808
|
+
})(subscriber));
|
|
1809
|
+
startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
1810
|
+
});
|
|
1811
|
+
};
|
|
1999
1812
|
}
|
|
2000
1813
|
function timeoutError(info) {
|
|
2001
|
-
|
|
1814
|
+
return fail_1(new TimeoutError(info));
|
|
2002
1815
|
}
|
|
2003
1816
|
function toArrayAccumulator(arr, value) {
|
|
2004
|
-
|
|
1817
|
+
return arr.push(value), arr;
|
|
2005
1818
|
}
|
|
2006
1819
|
/**
|
|
2007
|
-
|
|
2008
|
-
|
|
1820
|
+
* @tsplus getter fncts.observable.Observable toArray
|
|
1821
|
+
*/
|
|
2009
1822
|
function toArray_1(fa) {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
}
|
|
2014
|
-
/**
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
});
|
|
2035
|
-
};
|
|
1823
|
+
return new Observable((subscriber, environment) => {
|
|
1824
|
+
foldLeft_1([], toArrayAccumulator)(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* @tsplus pipeable fncts.observable.Observable unique
|
|
1829
|
+
*/
|
|
1830
|
+
function unique(toKey, flushes) {
|
|
1831
|
+
return (fa) => {
|
|
1832
|
+
return new Observable((subscriber, environment) => {
|
|
1833
|
+
let distinctKeys = tsplus_module_21.empty();
|
|
1834
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1835
|
+
const key = toKey ? toKey(value) : value;
|
|
1836
|
+
if (!tsplus_module_21.has(key)(distinctKeys)) {
|
|
1837
|
+
tsplus_module_21.add(key)(distinctKeys);
|
|
1838
|
+
subscriber.next(value);
|
|
1839
|
+
}
|
|
1840
|
+
} })(subscriber));
|
|
1841
|
+
flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1842
|
+
next: () => distinctKeys = tsplus_module_21.empty(),
|
|
1843
|
+
complete: tsplus_module_2.noop
|
|
1844
|
+
})(subscriber));
|
|
1845
|
+
});
|
|
1846
|
+
};
|
|
2036
1847
|
}
|
|
2037
1848
|
function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
if ("equals" in equals) {
|
|
2058
|
-
return fa => uniqueUntilChanged_1((x, y) => equals.equals(y[key])(x[key]))(fa);
|
|
2059
|
-
} else {
|
|
2060
|
-
return fa => uniqueUntilChanged_1((x, y) => equals(x[key], y[key]))(fa);
|
|
2061
|
-
}
|
|
1849
|
+
return (fa) => {
|
|
1850
|
+
const compare = "equals" in E ? E.equals : E;
|
|
1851
|
+
return new Observable((subscriber, environment) => {
|
|
1852
|
+
let previousKey;
|
|
1853
|
+
let first = true;
|
|
1854
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({ next: (value) => {
|
|
1855
|
+
const currentKey = keySelector(value);
|
|
1856
|
+
if (first || !compare(previousKey, currentKey)) {
|
|
1857
|
+
first = false;
|
|
1858
|
+
previousKey = currentKey;
|
|
1859
|
+
subscriber.next(value);
|
|
1860
|
+
}
|
|
1861
|
+
} })(subscriber));
|
|
1862
|
+
});
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
function uniqueUntilKeyChanged(key, equals) {
|
|
1866
|
+
if ("equals" in equals) return (fa) => uniqueUntilChanged_1((x, y) => equals.equals(y[key])(x[key]))(fa);
|
|
1867
|
+
else return (fa) => uniqueUntilChanged_1((x, y) => equals(x[key], y[key]))(fa);
|
|
2062
1868
|
}
|
|
2063
1869
|
function combineLatestInternal(subscriber, environment, observables, scheduler, valueTransform = tsplus_module_13.identity) {
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
if (! --active) {
|
|
2088
|
-
subscriber.complete();
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
})(subscriber));
|
|
2092
|
-
});
|
|
2093
|
-
}
|
|
2094
|
-
});
|
|
1870
|
+
return maybeSchedule(subscriber, scheduler, () => {
|
|
1871
|
+
const { length } = observables;
|
|
1872
|
+
const values = new Array(length);
|
|
1873
|
+
let active = length;
|
|
1874
|
+
let remainingFirstValues = length;
|
|
1875
|
+
for (let i = 0; i < length; i++) maybeSchedule(subscriber, scheduler, () => {
|
|
1876
|
+
const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
|
|
1877
|
+
let hasFirstValue = false;
|
|
1878
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1879
|
+
next: (value) => {
|
|
1880
|
+
values[i] = value;
|
|
1881
|
+
if (!hasFirstValue) {
|
|
1882
|
+
hasFirstValue = true;
|
|
1883
|
+
remainingFirstValues--;
|
|
1884
|
+
}
|
|
1885
|
+
if (!remainingFirstValues) subscriber.next(valueTransform(values.slice()));
|
|
1886
|
+
},
|
|
1887
|
+
complete: () => {
|
|
1888
|
+
if (!--active) subscriber.complete();
|
|
1889
|
+
}
|
|
1890
|
+
})(subscriber));
|
|
1891
|
+
});
|
|
1892
|
+
});
|
|
2095
1893
|
}
|
|
2096
1894
|
function findInternal(source, predicate, emit) {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
|
|
1895
|
+
const findIndex = emit === "index";
|
|
1896
|
+
return (subscriber, environment) => {
|
|
1897
|
+
let index = 0;
|
|
1898
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1899
|
+
next: (value) => {
|
|
1900
|
+
const i = index++;
|
|
1901
|
+
if (predicate(index++, value)) {
|
|
1902
|
+
subscriber.next(findIndex ? i : tsplus_module_17.just(value, fileName_1 + ":2684:49"));
|
|
1903
|
+
subscriber.complete();
|
|
1904
|
+
}
|
|
1905
|
+
},
|
|
1906
|
+
complete: () => {
|
|
1907
|
+
subscriber.next(findIndex ? -1 : tsplus_module_17.nothing(fileName_1 + ":2689:51"));
|
|
1908
|
+
subscriber.complete();
|
|
1909
|
+
}
|
|
1910
|
+
})(subscriber));
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
function joinAllInternal(fa, joiner) {
|
|
1914
|
+
return mergeMap_1(joiner)(toArray_1(fa));
|
|
2117
1915
|
}
|
|
2118
1916
|
function maybeSchedule(subscription, scheduler, execute) {
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
} else {
|
|
2122
|
-
execute();
|
|
2123
|
-
}
|
|
1917
|
+
if (scheduler) subscription.add(scheduler.schedule(execute));
|
|
1918
|
+
else execute();
|
|
2124
1919
|
}
|
|
2125
1920
|
function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
subscriber.complete();
|
|
2191
|
-
})
|
|
2192
|
-
})(subscriber));
|
|
2193
|
-
}
|
|
1921
|
+
const buffer = [];
|
|
1922
|
+
let active = 0;
|
|
1923
|
+
let index = 0;
|
|
1924
|
+
let isComplete = false;
|
|
1925
|
+
const checkComplete = () => {
|
|
1926
|
+
if (isComplete && !buffer.length && !active) subscriber.complete();
|
|
1927
|
+
};
|
|
1928
|
+
const outerNext = (a) => active < concurrent ? doInnerSub(a) : buffer.push(a);
|
|
1929
|
+
const doInnerSub = (a) => {
|
|
1930
|
+
expand && subscriber.next(a);
|
|
1931
|
+
active++;
|
|
1932
|
+
let innerComplete = false;
|
|
1933
|
+
from_1(f(index++, a)).provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
1934
|
+
next: (b) => {
|
|
1935
|
+
onBeforeNext?.(b);
|
|
1936
|
+
if (expand) outerNext(b);
|
|
1937
|
+
else subscriber.next(b);
|
|
1938
|
+
},
|
|
1939
|
+
complete: () => {
|
|
1940
|
+
innerComplete = true;
|
|
1941
|
+
}
|
|
1942
|
+
}, () => {
|
|
1943
|
+
if (innerComplete) try {
|
|
1944
|
+
active--;
|
|
1945
|
+
while (buffer.length && active < concurrent) {
|
|
1946
|
+
const bufferedValue = buffer.shift();
|
|
1947
|
+
innerSubScheduler ? subscriber.add(innerSubScheduler.schedule(() => doInnerSub(bufferedValue))) : doInnerSub(bufferedValue);
|
|
1948
|
+
}
|
|
1949
|
+
checkComplete();
|
|
1950
|
+
} catch (err) {
|
|
1951
|
+
subscriber.error(tsplus_module_1.halt(err));
|
|
1952
|
+
}
|
|
1953
|
+
}));
|
|
1954
|
+
};
|
|
1955
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
1956
|
+
next: outerNext,
|
|
1957
|
+
complete: () => {
|
|
1958
|
+
isComplete = true;
|
|
1959
|
+
checkComplete();
|
|
1960
|
+
}
|
|
1961
|
+
}));
|
|
1962
|
+
return () => {
|
|
1963
|
+
additionalTeardown?.();
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
function scanInternal(source, subscriber, environment, f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
|
|
1967
|
+
let hasState = hasInitial;
|
|
1968
|
+
let state = initial;
|
|
1969
|
+
let index = 0;
|
|
1970
|
+
return source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1971
|
+
next: (value) => {
|
|
1972
|
+
const i = index++;
|
|
1973
|
+
state = hasState ? f(i, state, value) : (hasState = true, value);
|
|
1974
|
+
emitOnNext && subscriber.next(state);
|
|
1975
|
+
},
|
|
1976
|
+
complete: emitBeforeComplete && (() => {
|
|
1977
|
+
hasState && subscriber.next(state);
|
|
1978
|
+
subscriber.complete();
|
|
1979
|
+
})
|
|
1980
|
+
})(subscriber));
|
|
1981
|
+
}
|
|
1982
|
+
//#endregion
|
|
1983
|
+
export { TimeoutError, _if, ap, as, at, audit, auditTime, buffer, bufferCount, bufferTime, bufferToggle, bufferWhen, catchAllCause, combineLatestAll, concat, concatAll, concatMap, concatMapWithIndex, contramapEnvironment, count, countWith, countWithIndex, debounce, debounceWith, defaultThrottleConfig, defer, delay, delayWith, delayWithIndex, dematerialize, either, empty, ensuring, environmentWithObservable, exhaustAll, exhaustMap, exhaustMapWithIndex, expand, expandWithIndex, fail, failCause, filter, filterMap, filterMapWithIndex, filterWithIndex, find, findIndex, findIndexWithIndex, findWithIndex, flatten, foldLeft, foldLeftWithIndex, forkJoin, from, fromArrayLike, fromAsyncIterable, fromIO, fromInterop, fromIterable, fromPromise, fromReadableStreamLike, fromSubscribable, halt, _if_1 as if, ignore, interval, isEmpty, iterate, joinAllInternal, makeZip, mapError, mapWithIndex, map_, materialize, merge, mergeAll, mergeMap, mergeMapWithIndex, mergeScan, mergeScanWithIndex, of, onEmpty, onErrorResumeNext, partition, partitionMap, partitionMapWithIndex, partitionWithIndex, provideService, repeat, retry, sample, sampleTime, scanInternal, scanLeft, scanLeftWithIndex, scheduleArray, scheduleAsyncIterable, scheduleIterable, scheduleObservable, schedulePromise, scheduleReadableStreamLike, scheduled, service, serviceWith, serviceWithObservable, single, skip, skipLast, skipUntil, skipWhile, startWith, subscribeOn, swap, switchAll, switchMap, switchMapWithIndex, switchScan, switchScanWithIndex, take, takeLast, takeUntil, takeWhile, takeWhileWithIndex, tap, throttle, throttleTime, timeout, timer, toArray, unique, uniqueUntilChanged, uniqueUntilKeyChanged, unit, zip, zipLatest, zipWith, zipWithLatest };
|
|
1984
|
+
|
|
2194
1985
|
//# sourceMappingURL=api.mjs.map
|