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