@dereekb/rxjs 13.3.1 → 13.4.1
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/index.cjs.js +240 -184
- package/index.esm.js +241 -185
- package/package.json +2 -2
- package/src/lib/filter/filter.map.d.ts +4 -0
- package/src/lib/filter/filter.source.d.ts +9 -3
- package/src/lib/iterator/iteration.accumulator.d.ts +21 -7
- package/src/lib/loading/loading.context.simple.d.ts +2 -0
- package/src/lib/loading/loading.context.state.d.ts +4 -0
- package/src/lib/loading/loading.state.d.ts +11 -5
- package/src/lib/loading/loading.state.rxjs.d.ts +6 -5
- package/src/lib/lock.d.ts +25 -13
- package/src/lib/object.d.ts +1 -1
- package/src/lib/rxjs/boolean.d.ts +6 -0
- package/src/lib/rxjs/expires.d.ts +7 -1
- package/src/lib/rxjs/getter.d.ts +7 -2
- package/src/lib/rxjs/misc.d.ts +1 -1
- package/src/lib/rxjs/model.d.ts +4 -0
- package/src/lib/rxjs/rxjs.async.d.ts +5 -5
- package/src/lib/rxjs/set.d.ts +4 -0
- package/src/lib/rxjs/value.d.ts +44 -8
- package/src/lib/subscription.d.ts +4 -0
- package/src/lib/work/work.factory.d.ts +2 -0
- package/src/lib/work/work.instance.d.ts +12 -3
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isObservable, of, switchMap, combineLatest, map, delay, startWith, filter, skipWhile, EMPTY, distinctUntilChanged, mergeMap, BehaviorSubject, shareReplay, skip, defaultIfEmpty, first, finalize, merge, firstValueFrom, exhaustMap, scan, identity, throttleTime, takeWhile, timeout, tap, throwError, timer, delayWhen, asyncScheduler, from, catchError, Subject } from 'rxjs';
|
|
2
|
-
import { getValueFromGetter, isMaybeSo, filterMaybeArrayValues, areEqualPOJOValues, convertToArray, asGetter, performTaskLoop, isMaybeNot, forEachWithArray, pushArrayItemsIntoArray,
|
|
2
|
+
import { getValueFromGetter, isMaybeSo, filterMaybeArrayValues, areEqualPOJOValues, convertToArray, asGetter, performTaskLoop, isMaybeNot, forEachWithArray, pushArrayItemsIntoArray, asArray, pushItemOrArrayItemsIntoArray, filterAndMapFunction, expirationDetails, objectKeysEqualityComparatorFunction, objectKeyEqualityComparatorFunction, asPromise, randomNumberFactory, mapsHaveSameKeys, mapKeysIntersectionObjectToArray, incrementingNumberFactory, filterUniqueFunction, build, cachedGetter, allKeyValueTuples, keyValueMapFactory, multiKeyValueMapFactory, timePeriodCounter, hasSameValues, compareEqualityWithValueFromItemsFunction, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, searchStringFilterFunction, reduceBooleansWithAnd, toReadableError, reduceBooleansWithOr, valuesAreBothNullishOrEquivalent, mergeObjects, objectHasKey, safeCompareEquality, hasNonNullValue, limitArray, mapFunctionOutputPair, lastValue, flattenArray, hasValueOrNotEmpty, filteredPage, invertMaybeBoolean, FIRST_PAGE, getNextPageNumber, reduceBooleansWithOrFn, MS_IN_SECOND } from '@dereekb/util';
|
|
3
3
|
|
|
4
4
|
function asObservable(valueOrObs) {
|
|
5
5
|
if (isObservable(valueOrObs)) {
|
|
@@ -28,7 +28,7 @@ function asObservable(valueOrObs) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
function asObservableFromGetter(input, args) {
|
|
31
|
-
var obs = getValueFromGetter(input, args);
|
|
31
|
+
var obs = getValueFromGetter(input, args); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
32
32
|
return asObservable(obs);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -43,6 +43,8 @@ function asObservableFromGetter(input, args) {
|
|
|
43
43
|
/**
|
|
44
44
|
* RxJS operator that flattens an emitted Maybe<{@link ObservableOrValueGetter}> into its resolved value,
|
|
45
45
|
* emitting `undefined` when the input is nullish.
|
|
46
|
+
*
|
|
47
|
+
* @returns an operator that unwraps Maybe<ObservableOrValueGetter> emissions, emitting undefined for nullish inputs
|
|
46
48
|
*/ function maybeValueFromObservableOrValueGetter() {
|
|
47
49
|
return switchMap(function(x) {
|
|
48
50
|
return x != null ? asObservableFromGetter(x) : of(undefined);
|
|
@@ -137,6 +139,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
137
139
|
*
|
|
138
140
|
* @param isCheckFunction - optional check function
|
|
139
141
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
142
|
+
* @returns a function that evaluates each value against the check function and returns it or undefined
|
|
140
143
|
*/ function makeReturnIfIsFunction(isCheckFunction, defaultValueOnMaybe) {
|
|
141
144
|
return function(value) {
|
|
142
145
|
return returnIfIs(isCheckFunction, value, defaultValueOnMaybe);
|
|
@@ -148,6 +151,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
148
151
|
* @param isCheckFunction - optional check function
|
|
149
152
|
* @param value - the value to check
|
|
150
153
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
154
|
+
* @returns an observable that emits the value if the check passes, or undefined otherwise
|
|
151
155
|
*/ function returnIfIs(isCheckFunction, value, defaultValueOnMaybe) {
|
|
152
156
|
return checkIs(isCheckFunction, value, defaultValueOnMaybe).pipe(map(function(x) {
|
|
153
157
|
return x ? value : undefined;
|
|
@@ -158,6 +162,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
158
162
|
*
|
|
159
163
|
* @param isCheckFunction - optional check function
|
|
160
164
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
165
|
+
* @returns a function that evaluates each value against the check function and returns an observable boolean
|
|
161
166
|
*/ function makeCheckIsFunction(isCheckFunction, defaultValueOnMaybe) {
|
|
162
167
|
return function(value) {
|
|
163
168
|
return checkIs(isCheckFunction, value, defaultValueOnMaybe);
|
|
@@ -171,6 +176,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
171
176
|
* @param isCheckFunction - optional check function
|
|
172
177
|
* @param value - the value to check
|
|
173
178
|
* @param defaultValueOnMaybe - default result for null/undefined values (defaults to false)
|
|
179
|
+
* @returns an observable boolean indicating whether the value passes the check
|
|
174
180
|
*/ function checkIs(isCheckFunction, value) {
|
|
175
181
|
var defaultValueOnMaybe = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
176
182
|
var is = isCheckFunction ? value != null ? isCheckFunction(value) : of(defaultValueOnMaybe) : of(true);
|
|
@@ -179,6 +185,8 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
179
185
|
// MARK: Filter
|
|
180
186
|
/**
|
|
181
187
|
* RxJS operator that filters out null and undefined values, only passing through defined values.
|
|
188
|
+
*
|
|
189
|
+
* @returns operator that filters out null and undefined emissions
|
|
182
190
|
*/ function filterMaybe() {
|
|
183
191
|
return filter(isMaybeSo);
|
|
184
192
|
}
|
|
@@ -187,11 +195,15 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
187
195
|
*/ var filterMaybeStrict = filterMaybe;
|
|
188
196
|
/**
|
|
189
197
|
* RxJS operator that filters out null/undefined elements from an emitted array, keeping only defined values.
|
|
198
|
+
*
|
|
199
|
+
* @returns operator that maps each emitted array to a version with null/undefined elements removed
|
|
190
200
|
*/ function filterMaybeArray() {
|
|
191
201
|
return map(filterMaybeArrayValues);
|
|
192
202
|
}
|
|
193
203
|
/**
|
|
194
204
|
* RxJS operator that skips all leading null/undefined emissions, then passes all subsequent values through.
|
|
205
|
+
*
|
|
206
|
+
* @returns operator that skips all null/undefined emissions at the start of the stream
|
|
195
207
|
*/ function skipAllInitialMaybe() {
|
|
196
208
|
return skipWhile(function(x) {
|
|
197
209
|
return x == null;
|
|
@@ -199,6 +211,8 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
199
211
|
}
|
|
200
212
|
/**
|
|
201
213
|
* RxJS operator that skips only the first emission if it is null/undefined, then passes all subsequent values.
|
|
214
|
+
*
|
|
215
|
+
* @returns operator that skips the first null/undefined emission if it occurs at the start of the stream
|
|
202
216
|
*/ function skipInitialMaybe() {
|
|
203
217
|
return skipMaybes(1);
|
|
204
218
|
}
|
|
@@ -206,6 +220,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
206
220
|
* RxJS operator that skips up to `maxToSkip` null/undefined emissions, then passes all subsequent values.
|
|
207
221
|
*
|
|
208
222
|
* @param maxToSkip - maximum number of null/undefined emissions to skip
|
|
223
|
+
* @returns operator that skips the first N null/undefined emissions from the stream
|
|
209
224
|
*/ function skipMaybes(maxToSkip) {
|
|
210
225
|
return skipWhile(function(x, i) {
|
|
211
226
|
return x == null && i < maxToSkip;
|
|
@@ -227,7 +242,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
227
242
|
});
|
|
228
243
|
}
|
|
229
244
|
function switchMapToDefault(defaultObs, useDefault) {
|
|
230
|
-
var useDefaultFn = useDefault ? useDefault : function(x) {
|
|
245
|
+
var useDefaultFn = useDefault !== null && useDefault !== void 0 ? useDefault : function(x) {
|
|
231
246
|
return of(x == null);
|
|
232
247
|
};
|
|
233
248
|
return switchMap(function(x) {
|
|
@@ -243,6 +258,9 @@ function switchMapToDefault(defaultObs, useDefault) {
|
|
|
243
258
|
/**
|
|
244
259
|
* RxJS operator that resolves an observable/getter config input into a value, applying defaults
|
|
245
260
|
* for `null`/`undefined`/`true` inputs and emitting `null` for `false`.
|
|
261
|
+
*
|
|
262
|
+
* @param config - configuration providing an optional default getter for null/undefined/true inputs
|
|
263
|
+
* @returns operator that resolves each emitted getter into a value, using the default for nullish or true inputs
|
|
246
264
|
*/ function switchMapObject(config) {
|
|
247
265
|
var defaultGetter = config.defaultGetter;
|
|
248
266
|
return switchMap(function(inputConfig) {
|
|
@@ -277,6 +295,8 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
277
295
|
* RxJS operator that filters out null/undefined observables and then switches to the remaining ones.
|
|
278
296
|
*
|
|
279
297
|
* Combines {@link filterMaybe} and `switchMap` to only subscribe to non-nullish observables.
|
|
298
|
+
*
|
|
299
|
+
* @returns operator that filters nullish observables and subscribes to the non-nullish ones
|
|
280
300
|
*/ function switchMapFilterMaybe() {
|
|
281
301
|
return function(source) {
|
|
282
302
|
var subscriber = source.pipe(filterMaybe(), switchMap(function(x) {
|
|
@@ -287,10 +307,12 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
287
307
|
}
|
|
288
308
|
/**
|
|
289
309
|
* RxJS operator that switches to the emitted observable if defined, or emits `undefined` when the observable is nullish.
|
|
310
|
+
*
|
|
311
|
+
* @returns operator that switches to the emitted observable or emits undefined for null/undefined inputs
|
|
290
312
|
*/ function switchMapMaybe() {
|
|
291
313
|
return function(source) {
|
|
292
314
|
var subscriber = source.pipe(switchMap(function(x) {
|
|
293
|
-
return x
|
|
315
|
+
return x !== null && x !== void 0 ? x : of(undefined);
|
|
294
316
|
}));
|
|
295
317
|
return subscriber;
|
|
296
318
|
};
|
|
@@ -315,11 +337,11 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
315
337
|
});
|
|
316
338
|
}
|
|
317
339
|
/**
|
|
318
|
-
* Combines
|
|
340
|
+
* Combines the source observable with another observable via `combineLatest`, then maps the pair to a result.
|
|
319
341
|
*
|
|
320
|
-
* @param combineObs
|
|
321
|
-
* @param mapFn
|
|
322
|
-
* @returns
|
|
342
|
+
* @param combineObs - the secondary observable to combine with the source
|
|
343
|
+
* @param mapFn - function that maps the source value and combined value to the output
|
|
344
|
+
* @returns operator that combines the source with `combineObs` and maps each pair using `mapFn`
|
|
323
345
|
*/ function combineLatestMapFrom(combineObs, mapFn) {
|
|
324
346
|
return function(obs) {
|
|
325
347
|
return combineLatest([
|
|
@@ -335,6 +357,11 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
335
357
|
* Creates an observable that emits a starting value, then a second value after a delay.
|
|
336
358
|
*
|
|
337
359
|
* If the delay is not provided, or is falsy, then the second value is never emitted.
|
|
360
|
+
*
|
|
361
|
+
* @param startWith - the value to emit immediately
|
|
362
|
+
* @param endWith - the value to emit after the delay
|
|
363
|
+
* @param delayTime - optional delay in milliseconds before emitting the second value
|
|
364
|
+
* @returns an observable that emits `startWith` immediately and `endWith` after the delay (if provided)
|
|
338
365
|
*/ function emitDelayObs(startWith, endWith, delayTime) {
|
|
339
366
|
var obs = of(startWith);
|
|
340
367
|
if (delayTime) {
|
|
@@ -344,6 +371,10 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
344
371
|
}
|
|
345
372
|
/**
|
|
346
373
|
* Emits a value after a given delay after every new emission.
|
|
374
|
+
*
|
|
375
|
+
* @param value - the value to emit after the delay
|
|
376
|
+
* @param delayTime - duration in milliseconds before emitting the value
|
|
377
|
+
* @returns operator that appends the given value after each source emission with the specified delay
|
|
347
378
|
*/ function emitAfterDelay(value, delayTime) {
|
|
348
379
|
return function(obs) {
|
|
349
380
|
return obs.pipe(switchMap(function(x) {
|
|
@@ -373,15 +404,12 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
373
404
|
});
|
|
374
405
|
}
|
|
375
406
|
function filterIfObjectValuesUnchanged(input) {
|
|
376
|
-
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return !areEqualPOJOValues(input, inputObject);
|
|
383
|
-
});
|
|
384
|
-
}
|
|
407
|
+
var result = isObservable(input) ? mergeMap(function(inputFilter) {
|
|
408
|
+
return input.pipe(filterIfObjectValuesUnchanged(inputFilter));
|
|
409
|
+
}) : filter(function(inputObject) {
|
|
410
|
+
return !areEqualPOJOValues(input, inputObject);
|
|
411
|
+
});
|
|
412
|
+
return result;
|
|
385
413
|
}
|
|
386
414
|
|
|
387
415
|
function _array_like_to_array$a(arr, len) {
|
|
@@ -389,7 +417,7 @@ function _array_like_to_array$a(arr, len) {
|
|
|
389
417
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
390
418
|
return arr2;
|
|
391
419
|
}
|
|
392
|
-
function _array_without_holes$
|
|
420
|
+
function _array_without_holes$6(arr) {
|
|
393
421
|
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
394
422
|
}
|
|
395
423
|
function _class_call_check$8(instance, Constructor) {
|
|
@@ -423,14 +451,14 @@ function _define_property$c(obj, key, value) {
|
|
|
423
451
|
}
|
|
424
452
|
return obj;
|
|
425
453
|
}
|
|
426
|
-
function _iterable_to_array$
|
|
454
|
+
function _iterable_to_array$6(iter) {
|
|
427
455
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
428
456
|
}
|
|
429
|
-
function _non_iterable_spread$
|
|
457
|
+
function _non_iterable_spread$6() {
|
|
430
458
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
431
459
|
}
|
|
432
|
-
function _to_consumable_array$
|
|
433
|
-
return _array_without_holes$
|
|
460
|
+
function _to_consumable_array$6(arr) {
|
|
461
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$6();
|
|
434
462
|
}
|
|
435
463
|
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
436
464
|
if (!o) return;
|
|
@@ -470,6 +498,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
470
498
|
key: "hasSubscription",
|
|
471
499
|
get: /**
|
|
472
500
|
* Whether a subscription is currently being managed.
|
|
501
|
+
*
|
|
502
|
+
* @returns true if a subscription is currently active
|
|
473
503
|
*/ function get() {
|
|
474
504
|
return Boolean(this._subscription);
|
|
475
505
|
}
|
|
@@ -549,6 +579,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
549
579
|
key: "hasSubscription",
|
|
550
580
|
get: /**
|
|
551
581
|
* Whether any subscriptions are currently being managed.
|
|
582
|
+
*
|
|
583
|
+
* @returns true if one or more subscriptions are currently active
|
|
552
584
|
*/ function get() {
|
|
553
585
|
var _this__subscriptions;
|
|
554
586
|
return Boolean((_this__subscriptions = this._subscriptions) === null || _this__subscriptions === void 0 ? void 0 : _this__subscriptions.length);
|
|
@@ -581,7 +613,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
581
613
|
*/ key: "addSubs",
|
|
582
614
|
value: function addSubs(subs) {
|
|
583
615
|
var _this__subscriptions;
|
|
584
|
-
var nextSubscriptions = _to_consumable_array$
|
|
616
|
+
var nextSubscriptions = _to_consumable_array$6((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
|
|
585
617
|
convertToArray(subs).forEach(function(sub) {
|
|
586
618
|
if (!nextSubscriptions.includes(sub)) {
|
|
587
619
|
nextSubscriptions.push(sub);
|
|
@@ -814,24 +846,23 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
814
846
|
key: "initFilterTakesPriority",
|
|
815
847
|
value: function initFilterTakesPriority() {
|
|
816
848
|
var _this = this;
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
849
|
+
var _this__initialFilterSub, _subscription;
|
|
850
|
+
(_subscription = (_this__initialFilterSub = this._initialFilterSub).subscription) !== null && _subscription !== void 0 ? _subscription : _this__initialFilterSub.subscription = this._initialFilterTakesPriority.pipe(switchMap(function(clearFilterOnInitialFilterPush) {
|
|
851
|
+
if (clearFilterOnInitialFilterPush) {
|
|
852
|
+
return _this._initialFilter.pipe(switchMap(function(x) {
|
|
853
|
+
return x !== null && x !== void 0 ? x : EMPTY;
|
|
854
|
+
}), filterMaybe(), map(function() {
|
|
855
|
+
return true;
|
|
856
|
+
}), skip(1) // skip the first emission
|
|
857
|
+
);
|
|
858
|
+
} else {
|
|
859
|
+
return EMPTY;
|
|
860
|
+
}
|
|
861
|
+
}), defaultIfEmpty(false)).subscribe(function(clear) {
|
|
862
|
+
if (clear) {
|
|
863
|
+
_this.resetFilter();
|
|
864
|
+
}
|
|
865
|
+
});
|
|
835
866
|
}
|
|
836
867
|
},
|
|
837
868
|
{
|
|
@@ -856,7 +887,7 @@ function _array_like_to_array$8(arr, len) {
|
|
|
856
887
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
857
888
|
return arr2;
|
|
858
889
|
}
|
|
859
|
-
function _array_without_holes$
|
|
890
|
+
function _array_without_holes$5(arr) {
|
|
860
891
|
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
861
892
|
}
|
|
862
893
|
function _class_call_check$6(instance, Constructor) {
|
|
@@ -890,14 +921,14 @@ function _define_property$a(obj, key, value) {
|
|
|
890
921
|
}
|
|
891
922
|
return obj;
|
|
892
923
|
}
|
|
893
|
-
function _iterable_to_array$
|
|
924
|
+
function _iterable_to_array$5(iter) {
|
|
894
925
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
895
926
|
}
|
|
896
|
-
function _non_iterable_spread$
|
|
927
|
+
function _non_iterable_spread$5() {
|
|
897
928
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
898
929
|
}
|
|
899
|
-
function _to_consumable_array$
|
|
900
|
-
return _array_without_holes$
|
|
930
|
+
function _to_consumable_array$5(arr) {
|
|
931
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$5();
|
|
901
932
|
}
|
|
902
933
|
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
903
934
|
if (!o) return;
|
|
@@ -1056,6 +1087,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1056
1087
|
{
|
|
1057
1088
|
/**
|
|
1058
1089
|
* Sets the default filter observable for this key.
|
|
1090
|
+
*
|
|
1091
|
+
* @param filterObs - the observable to use as the default filter for this key
|
|
1059
1092
|
*/ key: "initWithFilter",
|
|
1060
1093
|
value: function initWithFilter(filterObs) {
|
|
1061
1094
|
this.dbxFilterMap.addDefaultFilterObs(this.key, filterObs);
|
|
@@ -1064,6 +1097,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1064
1097
|
{
|
|
1065
1098
|
/**
|
|
1066
1099
|
* Connects a filter source, adding its filter observable to this key's merged filters.
|
|
1100
|
+
*
|
|
1101
|
+
* @param filterSource - the filter source whose filter$ will be added to this key's merged stream
|
|
1067
1102
|
*/ key: "connectWithSource",
|
|
1068
1103
|
value: function connectWithSource(filterSource) {
|
|
1069
1104
|
this.dbxFilterMap.addFilterObs(this.key, filterSource.filter$);
|
|
@@ -1081,7 +1116,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1081
1116
|
_define_property$a(this, "_source", new FilterSourceInstance());
|
|
1082
1117
|
_define_property$a(this, "_obs", new BehaviorSubject([]));
|
|
1083
1118
|
_define_property$a(this, "_obs$", this._obs.pipe(switchMap(function(x) {
|
|
1084
|
-
return merge.apply(void 0, _to_consumable_array$
|
|
1119
|
+
return merge.apply(void 0, _to_consumable_array$5(x.map(function(y) {
|
|
1085
1120
|
return y.obs;
|
|
1086
1121
|
})));
|
|
1087
1122
|
}), distinctUntilChanged()));
|
|
@@ -1122,7 +1157,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1122
1157
|
var deleteOnComplete = obs.pipe(finalize(function() {
|
|
1123
1158
|
_this._deleteFilterObs(i);
|
|
1124
1159
|
})).subscribe();
|
|
1125
|
-
var nextObs = _to_consumable_array$
|
|
1160
|
+
var nextObs = _to_consumable_array$5(currentObs).concat([
|
|
1126
1161
|
{
|
|
1127
1162
|
i: i,
|
|
1128
1163
|
obs: obs,
|
|
@@ -1529,17 +1564,17 @@ function _array_like_to_array$7(arr, len) {
|
|
|
1529
1564
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1530
1565
|
return arr2;
|
|
1531
1566
|
}
|
|
1532
|
-
function _array_without_holes$
|
|
1567
|
+
function _array_without_holes$4(arr) {
|
|
1533
1568
|
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
1534
1569
|
}
|
|
1535
|
-
function _iterable_to_array$
|
|
1570
|
+
function _iterable_to_array$4(iter) {
|
|
1536
1571
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1537
1572
|
}
|
|
1538
|
-
function _non_iterable_spread$
|
|
1573
|
+
function _non_iterable_spread$4() {
|
|
1539
1574
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1540
1575
|
}
|
|
1541
|
-
function _to_consumable_array$
|
|
1542
|
-
return _array_without_holes$
|
|
1576
|
+
function _to_consumable_array$4(arr) {
|
|
1577
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
|
|
1543
1578
|
}
|
|
1544
1579
|
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
1545
1580
|
if (!o) return;
|
|
@@ -1565,7 +1600,7 @@ function scanIntoArray() {
|
|
|
1565
1600
|
return scan(function(acc, next) {
|
|
1566
1601
|
if (next != null) {
|
|
1567
1602
|
if (immutable) {
|
|
1568
|
-
acc = acc.concat(next);
|
|
1603
|
+
acc = _to_consumable_array$4(acc).concat(_to_consumable_array$4(asArray(next)));
|
|
1569
1604
|
} else {
|
|
1570
1605
|
acc = pushItemOrArrayItemsIntoArray(acc, next);
|
|
1571
1606
|
}
|
|
@@ -1595,7 +1630,7 @@ function scanIntoArray() {
|
|
|
1595
1630
|
}
|
|
1596
1631
|
return acc;
|
|
1597
1632
|
}, seed !== null && seed !== void 0 ? seed : []), distinctUntilArrayLengthChanges(), map(function(x) {
|
|
1598
|
-
return _to_consumable_array$
|
|
1633
|
+
return _to_consumable_array$4(x);
|
|
1599
1634
|
}), shareReplay(1));
|
|
1600
1635
|
});
|
|
1601
1636
|
}
|
|
@@ -1685,7 +1720,7 @@ function scanIntoArray() {
|
|
|
1685
1720
|
if (!acc.fromMatch || requireConsecutive) {
|
|
1686
1721
|
fromMatch = isMatch(from, next);
|
|
1687
1722
|
value = next;
|
|
1688
|
-
} else
|
|
1723
|
+
} else {
|
|
1689
1724
|
value = acc.value;
|
|
1690
1725
|
}
|
|
1691
1726
|
}
|
|
@@ -1719,6 +1754,8 @@ function scanIntoArray() {
|
|
|
1719
1754
|
}
|
|
1720
1755
|
/**
|
|
1721
1756
|
* RxJS operator that negates each emitted boolean value.
|
|
1757
|
+
*
|
|
1758
|
+
* @returns operator that maps each boolean emission to its negated value
|
|
1722
1759
|
*/ function isNot() {
|
|
1723
1760
|
return map(function(x) {
|
|
1724
1761
|
return !x;
|
|
@@ -1726,6 +1763,8 @@ function scanIntoArray() {
|
|
|
1726
1763
|
}
|
|
1727
1764
|
/**
|
|
1728
1765
|
* RxJS operator that only emits when a boolean stream transitions from `true` to `false`.
|
|
1766
|
+
*
|
|
1767
|
+
* @returns operator that filters to only true-to-false transition emissions
|
|
1729
1768
|
*/ function onTrueToFalse() {
|
|
1730
1769
|
return onMatchDelta({
|
|
1731
1770
|
from: true,
|
|
@@ -1735,6 +1774,8 @@ function scanIntoArray() {
|
|
|
1735
1774
|
}
|
|
1736
1775
|
/**
|
|
1737
1776
|
* RxJS operator that only emits when a boolean stream transitions from `false` to `true`.
|
|
1777
|
+
*
|
|
1778
|
+
* @returns operator that filters to only false-to-true transition emissions
|
|
1738
1779
|
*/ function onFalseToTrue() {
|
|
1739
1780
|
return onMatchDelta({
|
|
1740
1781
|
from: false,
|
|
@@ -1753,6 +1794,7 @@ function scanIntoArray() {
|
|
|
1753
1794
|
* @returns the inverted (or original) decision function
|
|
1754
1795
|
*/ function invertObservableDecision(decisionFn) {
|
|
1755
1796
|
var invert = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1797
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1756
1798
|
if (invert) {
|
|
1757
1799
|
return function(value) {
|
|
1758
1800
|
var obs = decisionFn(value);
|
|
@@ -1807,7 +1849,7 @@ function scanIntoArray() {
|
|
|
1807
1849
|
* time relative to the current moment.
|
|
1808
1850
|
*
|
|
1809
1851
|
* @param expiresIn - duration in milliseconds until expiration
|
|
1810
|
-
* @returns an
|
|
1852
|
+
* @returns an `OperatorFunction` that maps each emission to an {@link Expires} object
|
|
1811
1853
|
*/ function toExpiration(expiresIn) {
|
|
1812
1854
|
return map(function() {
|
|
1813
1855
|
var now = new Date();
|
|
@@ -1822,6 +1864,8 @@ function scanIntoArray() {
|
|
|
1822
1864
|
}
|
|
1823
1865
|
/**
|
|
1824
1866
|
* RxJS operator that filters out emissions whose {@link Expires} value has already expired.
|
|
1867
|
+
*
|
|
1868
|
+
* @returns operator that only passes through non-expired emissions
|
|
1825
1869
|
*/ function skipExpired() {
|
|
1826
1870
|
return filter(function(expires) {
|
|
1827
1871
|
return !expirationDetails({
|
|
@@ -1833,6 +1877,7 @@ function scanIntoArray() {
|
|
|
1833
1877
|
* RxJS operator that skips emissions until the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1834
1878
|
*
|
|
1835
1879
|
* @param expiresIn - duration in milliseconds
|
|
1880
|
+
* @returns operator that skips emissions until the time window has elapsed
|
|
1836
1881
|
*/ function skipUntilExpiration(expiresIn) {
|
|
1837
1882
|
return filter(function(x) {
|
|
1838
1883
|
return expirationDetails({
|
|
@@ -1845,6 +1890,7 @@ function scanIntoArray() {
|
|
|
1845
1890
|
* RxJS operator that skips emissions after the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1846
1891
|
*
|
|
1847
1892
|
* @param expiresIn - duration in milliseconds
|
|
1893
|
+
* @returns operator that passes through emissions only within the time window
|
|
1848
1894
|
*/ function skipAfterExpiration(expiresIn) {
|
|
1849
1895
|
return filter(function(x) {
|
|
1850
1896
|
return !expirationDetails({
|
|
@@ -1858,6 +1904,7 @@ function scanIntoArray() {
|
|
|
1858
1904
|
*
|
|
1859
1905
|
* @param watch - observable whose emissions reset the time window
|
|
1860
1906
|
* @param takeFor - duration in milliseconds of each time window
|
|
1907
|
+
* @returns operator that limits source emissions to the active time window after each watch emission
|
|
1861
1908
|
*/ function skipUntilTimeElapsedAfterLastEmission(watch, takeFor) {
|
|
1862
1909
|
return function(observable) {
|
|
1863
1910
|
return watch.pipe(switchMap(function() {
|
|
@@ -1877,6 +1924,7 @@ function scanIntoArray() {
|
|
|
1877
1924
|
*
|
|
1878
1925
|
* @param watch - observable whose emissions reset the skip window
|
|
1879
1926
|
* @param skipFor - duration in milliseconds to skip after each watch emission
|
|
1927
|
+
* @returns an operator that delays passing values through until time has elapsed since the last watch emission
|
|
1880
1928
|
*/ function takeAfterTimeElapsedSinceLastEmission(watch, skipFor) {
|
|
1881
1929
|
return function(observable) {
|
|
1882
1930
|
return watch.pipe(switchMap(function() {
|
|
@@ -2028,7 +2076,7 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
|
|
|
2028
2076
|
return result;
|
|
2029
2077
|
}), finalize(function() {
|
|
2030
2078
|
if (currentInstance) {
|
|
2031
|
-
destroy(currentInstance);
|
|
2079
|
+
void destroy(currentInstance);
|
|
2032
2080
|
}
|
|
2033
2081
|
}));
|
|
2034
2082
|
};
|
|
@@ -2104,6 +2152,8 @@ function tapLog(messageOrFunction) {
|
|
|
2104
2152
|
|
|
2105
2153
|
/**
|
|
2106
2154
|
* `distinctUntilChanged` variant that only emits when the model's `id` property changes.
|
|
2155
|
+
*
|
|
2156
|
+
* @returns operator that suppresses consecutive emissions with the same model `id`
|
|
2107
2157
|
*/ function distinctUntilModelIdChange() {
|
|
2108
2158
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2109
2159
|
return x.id;
|
|
@@ -2111,6 +2161,8 @@ function tapLog(messageOrFunction) {
|
|
|
2111
2161
|
}
|
|
2112
2162
|
/**
|
|
2113
2163
|
* `distinctUntilChanged` variant that only emits when the model's `key` property changes.
|
|
2164
|
+
*
|
|
2165
|
+
* @returns operator that suppresses consecutive emissions with the same model `key`
|
|
2114
2166
|
*/ function distinctUntilModelKeyChange() {
|
|
2115
2167
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2116
2168
|
return x.key;
|
|
@@ -2426,6 +2478,12 @@ function _array_like_to_array$5(arr, len) {
|
|
|
2426
2478
|
function _array_with_holes$2(arr) {
|
|
2427
2479
|
if (Array.isArray(arr)) return arr;
|
|
2428
2480
|
}
|
|
2481
|
+
function _array_without_holes$3(arr) {
|
|
2482
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
2483
|
+
}
|
|
2484
|
+
function _iterable_to_array$3(iter) {
|
|
2485
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2486
|
+
}
|
|
2429
2487
|
function _iterable_to_array_limit$2(arr, i) {
|
|
2430
2488
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2431
2489
|
if (_i == null) return;
|
|
@@ -2453,9 +2511,15 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
2453
2511
|
function _non_iterable_rest$2() {
|
|
2454
2512
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2455
2513
|
}
|
|
2514
|
+
function _non_iterable_spread$3() {
|
|
2515
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2516
|
+
}
|
|
2456
2517
|
function _sliced_to_array$2(arr, i) {
|
|
2457
2518
|
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
|
|
2458
2519
|
}
|
|
2520
|
+
function _to_consumable_array$3(arr) {
|
|
2521
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
|
|
2522
|
+
}
|
|
2459
2523
|
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2460
2524
|
if (!o) return;
|
|
2461
2525
|
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
@@ -2473,7 +2537,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2473
2537
|
*/ function combineLatestFromMapValuesObsFn(mapToObs) {
|
|
2474
2538
|
var combineArrayFn = combineLatestFromArrayObsFn(mapToObs);
|
|
2475
2539
|
return function(latestMap) {
|
|
2476
|
-
var mapValues =
|
|
2540
|
+
var mapValues = _to_consumable_array$3(latestMap).map(function(y) {
|
|
2477
2541
|
return y[1];
|
|
2478
2542
|
});
|
|
2479
2543
|
return combineArrayFn(mapValues);
|
|
@@ -2523,7 +2587,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2523
2587
|
var result = {};
|
|
2524
2588
|
latestValues.forEach(function(param) {
|
|
2525
2589
|
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
2526
|
-
result[key] = value;
|
|
2590
|
+
result[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
2527
2591
|
});
|
|
2528
2592
|
return result;
|
|
2529
2593
|
}));
|
|
@@ -2566,7 +2630,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2566
2630
|
*/ function errorOnEmissionsInPeriod(config) {
|
|
2567
2631
|
var _config_period = config.period, period = _config_period === void 0 ? 1000 : _config_period, maxEmissionsPerPeriod = config.maxEmissionsPerPeriod, onError = config.onError, inputErrorFactory = config.errorFactory, inputErrorMessage = config.errorMessage, switchToObs = config.switchToObs;
|
|
2568
2632
|
var errorMessage = inputErrorMessage !== null && inputErrorMessage !== void 0 ? inputErrorMessage : 'errorOnEmissionsInPeriod(): Too many emissions in time period.';
|
|
2569
|
-
var errorFactory = inputErrorFactory ? inputErrorFactory : !switchToObs ? function() {
|
|
2633
|
+
var errorFactory = inputErrorFactory !== null && inputErrorFactory !== void 0 ? inputErrorFactory : !switchToObs ? function() {
|
|
2570
2634
|
return new Error(errorMessage);
|
|
2571
2635
|
} : undefined;
|
|
2572
2636
|
return function(source) {
|
|
@@ -2626,6 +2690,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2626
2690
|
}
|
|
2627
2691
|
/**
|
|
2628
2692
|
* `distinctUntilChanged` variant for iterables that only emits when the contained values change.
|
|
2693
|
+
*
|
|
2694
|
+
* @returns operator that suppresses consecutive iterable emissions with the same set of values
|
|
2629
2695
|
*/ function distinctUntilHasDifferentValues() {
|
|
2630
2696
|
return distinctUntilChanged(hasSameValues);
|
|
2631
2697
|
}
|
|
@@ -2873,16 +2939,17 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2873
2939
|
* @param state - the loading state to check (may be null/undefined)
|
|
2874
2940
|
* @returns true if loading is complete
|
|
2875
2941
|
*/ function isLoadingStateFinishedLoading(state) {
|
|
2942
|
+
var result = false;
|
|
2876
2943
|
if (state) {
|
|
2877
2944
|
var loading = state.loading;
|
|
2878
2945
|
if (loading === true) {
|
|
2879
|
-
|
|
2946
|
+
result = false;
|
|
2880
2947
|
} else {
|
|
2881
|
-
|
|
2948
|
+
var _state_value;
|
|
2949
|
+
result = loading === false || Boolean((_state_value = state.value) !== null && _state_value !== void 0 ? _state_value : state.error) || state.value === null;
|
|
2882
2950
|
}
|
|
2883
|
-
} else {
|
|
2884
|
-
return false;
|
|
2885
2951
|
}
|
|
2952
|
+
return result;
|
|
2886
2953
|
}
|
|
2887
2954
|
/**
|
|
2888
2955
|
* Creates an idle {@link LoadingState} with `loading: false` and no value or error.
|
|
@@ -2895,6 +2962,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2895
2962
|
* // { loading: false }
|
|
2896
2963
|
* loadingStateType(state); // LoadingStateType.IDLE
|
|
2897
2964
|
* ```
|
|
2965
|
+
*
|
|
2966
|
+
* @returns a loading state with `loading: false` and no value or error
|
|
2898
2967
|
*/ function idleLoadingState() {
|
|
2899
2968
|
return {
|
|
2900
2969
|
loading: false
|
|
@@ -3019,11 +3088,7 @@ function beginLoading(state) {
|
|
|
3019
3088
|
*/ function isLoadingStateWithStateType(type) {
|
|
3020
3089
|
var defaultResult = type === LoadingStateType.IDLE ? true : false;
|
|
3021
3090
|
return function(state) {
|
|
3022
|
-
|
|
3023
|
-
return loadingStateType(state) === type;
|
|
3024
|
-
} else {
|
|
3025
|
-
return defaultResult;
|
|
3026
|
-
}
|
|
3091
|
+
return state ? loadingStateType(state) === type : defaultResult;
|
|
3027
3092
|
};
|
|
3028
3093
|
}
|
|
3029
3094
|
/**
|
|
@@ -3066,11 +3131,7 @@ function beginLoading(state) {
|
|
|
3066
3131
|
* @param state - the loading state to check
|
|
3067
3132
|
* @returns true if the state has a defined (non-undefined) value
|
|
3068
3133
|
*/ function isLoadingStateWithDefinedValue(state) {
|
|
3069
|
-
|
|
3070
|
-
return state.value !== undefined;
|
|
3071
|
-
} else {
|
|
3072
|
-
return false;
|
|
3073
|
-
}
|
|
3134
|
+
return state ? state.value !== undefined : false;
|
|
3074
3135
|
}
|
|
3075
3136
|
/**
|
|
3076
3137
|
* Type guard that checks whether a {@link LoadingState} has a non-null error, regardless of loading status.
|
|
@@ -3084,11 +3145,7 @@ function beginLoading(state) {
|
|
|
3084
3145
|
* @param state - the loading state to check
|
|
3085
3146
|
* @returns true if the state has an error
|
|
3086
3147
|
*/ function isLoadingStateWithError(state) {
|
|
3087
|
-
|
|
3088
|
-
return state.error != null;
|
|
3089
|
-
} else {
|
|
3090
|
-
return false;
|
|
3091
|
-
}
|
|
3148
|
+
return state ? state.error != null : false;
|
|
3092
3149
|
}
|
|
3093
3150
|
/**
|
|
3094
3151
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has a defined value.
|
|
@@ -3096,11 +3153,7 @@ function beginLoading(state) {
|
|
|
3096
3153
|
* @param state - the loading state to check
|
|
3097
3154
|
* @returns true if finished loading with a non-undefined value
|
|
3098
3155
|
*/ function isLoadingStateFinishedLoadingWithDefinedValue(state) {
|
|
3099
|
-
|
|
3100
|
-
return isLoadingStateFinishedLoading(state) && state.value !== undefined;
|
|
3101
|
-
} else {
|
|
3102
|
-
return false;
|
|
3103
|
-
}
|
|
3156
|
+
return state ? isLoadingStateFinishedLoading(state) && state.value !== undefined : false;
|
|
3104
3157
|
}
|
|
3105
3158
|
/**
|
|
3106
3159
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has an error.
|
|
@@ -3108,11 +3161,7 @@ function beginLoading(state) {
|
|
|
3108
3161
|
* @param state - the loading state to check
|
|
3109
3162
|
* @returns true if finished loading with an error
|
|
3110
3163
|
*/ function isLoadingStateFinishedLoadingWithError(state) {
|
|
3111
|
-
|
|
3112
|
-
return isLoadingStateFinishedLoading(state) && state.error != null;
|
|
3113
|
-
} else {
|
|
3114
|
-
return false;
|
|
3115
|
-
}
|
|
3164
|
+
return state ? isLoadingStateFinishedLoading(state) && state.error != null : false;
|
|
3116
3165
|
}
|
|
3117
3166
|
/**
|
|
3118
3167
|
* Compares the metadata (page, loading, error) of two {@link PageLoadingState} instances for equivalence.
|
|
@@ -3143,15 +3192,16 @@ function mergeLoadingStates() {
|
|
|
3143
3192
|
args[_key] = arguments[_key];
|
|
3144
3193
|
}
|
|
3145
3194
|
var _loadingStates_find;
|
|
3146
|
-
|
|
3195
|
+
// eslint-disable-line jsdoc/require-jsdoc -- JSDoc is on the overload signatures above
|
|
3196
|
+
/* eslint-enable @typescript-eslint/max-params, @typescript-eslint/no-explicit-any */ var validArgs = filterMaybeArrayValues(args); // filter out any undefined values
|
|
3147
3197
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3148
|
-
var loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
|
|
3198
|
+
var loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3149
3199
|
var mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : function() {
|
|
3150
3200
|
for(var _len = arguments.length, inputArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3151
3201
|
inputArgs[_key] = arguments[_key];
|
|
3152
3202
|
}
|
|
3153
3203
|
return mergeObjects(inputArgs);
|
|
3154
|
-
};
|
|
3204
|
+
}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3155
3205
|
var error = (_loadingStates_find = loadingStates.find(function(x) {
|
|
3156
3206
|
return x.error;
|
|
3157
3207
|
})) === null || _loadingStates_find === void 0 ? void 0 : _loadingStates_find.error; // find the first error
|
|
@@ -3159,7 +3209,7 @@ function mergeLoadingStates() {
|
|
|
3159
3209
|
if (error) {
|
|
3160
3210
|
// ignore all loading states, except for any error-prone item that is still loading
|
|
3161
3211
|
var currentLoadings = loadingStates.map(function(x) {
|
|
3162
|
-
return
|
|
3212
|
+
return x.error ? x.loading : false;
|
|
3163
3213
|
});
|
|
3164
3214
|
var nonMaybeLoadings = currentLoadings.filter(function(x) {
|
|
3165
3215
|
return x != null;
|
|
@@ -3245,10 +3295,10 @@ function mergeLoadingStates() {
|
|
|
3245
3295
|
var mapValues = config.mapValues, mapState = config.mapState;
|
|
3246
3296
|
var loading = isAnyLoadingStateInLoadingState(input);
|
|
3247
3297
|
var error = input.map(function(x) {
|
|
3248
|
-
return x
|
|
3249
|
-
}).
|
|
3298
|
+
return x.error;
|
|
3299
|
+
}).find(function(x) {
|
|
3250
3300
|
return Boolean(x);
|
|
3251
|
-
})
|
|
3301
|
+
});
|
|
3252
3302
|
var result;
|
|
3253
3303
|
if (!error && !loading) {
|
|
3254
3304
|
if (mapValues) {
|
|
@@ -3270,7 +3320,7 @@ function mergeLoadingStates() {
|
|
|
3270
3320
|
}
|
|
3271
3321
|
function mapLoadingStateResults(input, config) {
|
|
3272
3322
|
var mapValue = config.mapValue, mapState = config.mapState, _config_alwaysMapValue = config.alwaysMapValue, alwaysMapValue = _config_alwaysMapValue === void 0 ? false : _config_alwaysMapValue;
|
|
3273
|
-
var inputValue = input
|
|
3323
|
+
var inputValue = input.value;
|
|
3274
3324
|
var value;
|
|
3275
3325
|
if ((inputValue != null || alwaysMapValue) && mapValue) {
|
|
3276
3326
|
value = mapValue(inputValue, input);
|
|
@@ -3410,24 +3460,20 @@ function combineLoadingStates() {
|
|
|
3410
3460
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3411
3461
|
args[_key] = arguments[_key];
|
|
3412
3462
|
}
|
|
3413
|
-
|
|
3463
|
+
// eslint-disable-line jsdoc/require-jsdoc -- JSDoc is on the overload signatures above
|
|
3464
|
+
/* eslint-enable @typescript-eslint/max-params, @typescript-eslint/no-explicit-any */ var validArgs = filterMaybeArrayValues(args); // filter out any undefined values
|
|
3414
3465
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3415
|
-
var obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
|
|
3466
|
+
var obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3416
3467
|
var mergeFn = lastValueIsMergeFn ? validArgs[validArgs.length - 1] : undefined;
|
|
3417
3468
|
return combineLatest(obsArgs).pipe(distinctUntilChanged(function(x, y) {
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
}) === -1;
|
|
3422
|
-
return hasSameValues;
|
|
3423
|
-
} else {
|
|
3424
|
-
return x === y;
|
|
3425
|
-
}
|
|
3469
|
+
return !x.some(function(_, i) {
|
|
3470
|
+
return x[i] !== y[i];
|
|
3471
|
+
});
|
|
3426
3472
|
}), map(function(states) {
|
|
3427
|
-
|
|
3473
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3474
|
+
return mergeLoadingStates.apply(void 0, _to_consumable_array$1(states).concat([
|
|
3428
3475
|
mergeFn
|
|
3429
3476
|
]));
|
|
3430
|
-
return result;
|
|
3431
3477
|
}), shareReplay(1) // Share the result.
|
|
3432
3478
|
);
|
|
3433
3479
|
}
|
|
@@ -3454,6 +3500,7 @@ function combineLoadingStates() {
|
|
|
3454
3500
|
* @param sources - An array of LoadingState observables to combine.
|
|
3455
3501
|
* @returns An observable emitting a {@link LoadingState}<boolean> representing the combined status.
|
|
3456
3502
|
*/ function combineLoadingStatesStatus(sources) {
|
|
3503
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3457
3504
|
return combineLatest(sources).pipe(map(function(allLoadingStates) {
|
|
3458
3505
|
var firstErrorState = allLoadingStates.find(function(x) {
|
|
3459
3506
|
return x.error;
|
|
@@ -3462,7 +3509,7 @@ function combineLoadingStates() {
|
|
|
3462
3509
|
if (firstErrorState) {
|
|
3463
3510
|
result = errorResult(firstErrorState.error);
|
|
3464
3511
|
} else {
|
|
3465
|
-
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.
|
|
3512
|
+
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.some(isLoadingStateLoading);
|
|
3466
3513
|
if (oneOrMoreStatesAreCurrentlyLoading) {
|
|
3467
3514
|
result = beginLoading(); // still loading
|
|
3468
3515
|
} else {
|
|
@@ -3590,7 +3637,7 @@ function tapOnLoadingStateType(fn, type) {
|
|
|
3590
3637
|
};
|
|
3591
3638
|
}
|
|
3592
3639
|
return tap(function(state) {
|
|
3593
|
-
if (
|
|
3640
|
+
if (decisionFunction(state)) {
|
|
3594
3641
|
fn(state);
|
|
3595
3642
|
}
|
|
3596
3643
|
});
|
|
@@ -3742,6 +3789,10 @@ function distinctLoadingState(inputConfig) {
|
|
|
3742
3789
|
*
|
|
3743
3790
|
* Determines the `loading` flag based on whether an error is present, whether the value is defined,
|
|
3744
3791
|
* and the `showLoadingOnUndefinedValue` setting. Loading progress is only included while loading.
|
|
3792
|
+
*
|
|
3793
|
+
* @param state - the current loading state to convert into a context event
|
|
3794
|
+
* @param input - configuration input controlling how the loading flag is derived
|
|
3795
|
+
* @returns a loading state context event derived from the given state
|
|
3745
3796
|
*/ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION(state, input) {
|
|
3746
3797
|
var showLoadingOnUndefinedValue = input.showLoadingOnUndefinedValue;
|
|
3747
3798
|
var error = state.error, value = state.value, loadingProgress = state.loadingProgress;
|
|
@@ -3812,7 +3863,7 @@ function distinctLoadingState(inputConfig) {
|
|
|
3812
3863
|
return result;
|
|
3813
3864
|
}), distinctUntilChanged(isLoadingStateEqual), shareReplay(1));
|
|
3814
3865
|
var currentState$ = currentStateStream$.pipe(switchMap(function(x) {
|
|
3815
|
-
return x ? x : of(undefined);
|
|
3866
|
+
return x !== null && x !== void 0 ? x : of(undefined);
|
|
3816
3867
|
}));
|
|
3817
3868
|
var state$ = currentState$.pipe(filterMaybe(), shareReplay(1));
|
|
3818
3869
|
var loading$ = eventStream$.pipe(map(isLoadingStateLoading));
|
|
@@ -3856,7 +3907,8 @@ function distinctLoadingState(inputConfig) {
|
|
|
3856
3907
|
* @param listLoadingState - the list loading state to check
|
|
3857
3908
|
* @returns true if the value is empty or absent
|
|
3858
3909
|
*/ function isListLoadingStateWithEmptyValue(listLoadingState) {
|
|
3859
|
-
|
|
3910
|
+
var _listLoadingState_value;
|
|
3911
|
+
return Boolean(!((_listLoadingState_value = listLoadingState.value) === null || _listLoadingState_value === void 0 ? void 0 : _listLoadingState_value.length));
|
|
3860
3912
|
}
|
|
3861
3913
|
/**
|
|
3862
3914
|
* RxJS operator that maps each emitted {@link ListLoadingState} to a boolean indicating whether the list is empty.
|
|
@@ -4138,6 +4190,8 @@ function _object_spread_props$3(target, source) {
|
|
|
4138
4190
|
{
|
|
4139
4191
|
/**
|
|
4140
4192
|
* Whether the current state has a non-null error.
|
|
4193
|
+
*
|
|
4194
|
+
* @returns true if the current state contains an error
|
|
4141
4195
|
*/ key: "hasError",
|
|
4142
4196
|
value: function hasError() {
|
|
4143
4197
|
return isLoadingStateWithError(this._subject.value);
|
|
@@ -4630,55 +4684,48 @@ function itemAccumulator(itemIteration, inputMapItem) {
|
|
|
4630
4684
|
return from(asPromise(countResults(allItems)));
|
|
4631
4685
|
})).subscribe({
|
|
4632
4686
|
next: function next(currentResultsCount) {
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
result = _state.sent();
|
|
4649
|
-
currentResultsCount = result.currentCount;
|
|
4650
|
-
return [
|
|
4651
|
-
2,
|
|
4652
|
-
result.shouldContinue
|
|
4653
|
-
];
|
|
4654
|
-
}
|
|
4655
|
-
});
|
|
4656
|
-
})();
|
|
4657
|
-
},
|
|
4658
|
-
next: function next() {
|
|
4659
|
-
return _async_to_generator(function() {
|
|
4660
|
-
return _ts_generator(this, function(_state) {
|
|
4687
|
+
performTaskLoop({
|
|
4688
|
+
initValue: currentResultsCount,
|
|
4689
|
+
checkContinue: function checkContinue(_x, _i) {
|
|
4690
|
+
return _async_to_generator(function() {
|
|
4691
|
+
var result;
|
|
4692
|
+
return _ts_generator(this, function(_state) {
|
|
4693
|
+
switch(_state.label){
|
|
4694
|
+
case 0:
|
|
4695
|
+
return [
|
|
4696
|
+
4,
|
|
4697
|
+
checkResultsLimit()
|
|
4698
|
+
];
|
|
4699
|
+
case 1:
|
|
4700
|
+
result = _state.sent();
|
|
4701
|
+
currentResultsCount = result.currentCount;
|
|
4661
4702
|
return [
|
|
4662
4703
|
2,
|
|
4663
|
-
|
|
4704
|
+
result.shouldContinue
|
|
4664
4705
|
];
|
|
4665
|
-
|
|
4666
|
-
})();
|
|
4667
|
-
}
|
|
4668
|
-
}).then(function(page) {
|
|
4669
|
-
resolve({
|
|
4670
|
-
page: page,
|
|
4671
|
-
resultsCount: currentResultsCount
|
|
4706
|
+
}
|
|
4672
4707
|
});
|
|
4673
|
-
})
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4708
|
+
})();
|
|
4709
|
+
},
|
|
4710
|
+
next: function next() {
|
|
4711
|
+
return _async_to_generator(function() {
|
|
4712
|
+
return _ts_generator(this, function(_state) {
|
|
4713
|
+
return [
|
|
4714
|
+
2,
|
|
4715
|
+
accumulator.itemIteration.nextPage()
|
|
4716
|
+
];
|
|
4717
|
+
});
|
|
4718
|
+
})();
|
|
4719
|
+
}
|
|
4720
|
+
}).then(function(page) {
|
|
4721
|
+
resolve({
|
|
4722
|
+
page: page,
|
|
4723
|
+
resultsCount: currentResultsCount
|
|
4680
4724
|
});
|
|
4681
|
-
})()
|
|
4725
|
+
}).catch(function(error) {
|
|
4726
|
+
reject(error);
|
|
4727
|
+
throw error;
|
|
4728
|
+
});
|
|
4682
4729
|
},
|
|
4683
4730
|
error: function error(error) {
|
|
4684
4731
|
reject(error);
|
|
@@ -4745,7 +4792,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4745
4792
|
return accumulator.currentAllItemPairs$.pipe(scanBuildArray(function(allItems) {
|
|
4746
4793
|
var pairs = allItems;
|
|
4747
4794
|
var firstLatestItemPair = lastValue(allItems);
|
|
4748
|
-
var skipValue = firstLatestItemPair === null || firstLatestItemPair === void 0 ? void 0 : firstLatestItemPair.input;
|
|
4795
|
+
var skipValue = firstLatestItemPair === null || firstLatestItemPair === void 0 ? void 0 : firstLatestItemPair.input; // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- lastValue() can return undefined at runtime for empty arrays
|
|
4749
4796
|
var seed = flattenArray(pairs.map(function(x) {
|
|
4750
4797
|
return x.output;
|
|
4751
4798
|
}));
|
|
@@ -4812,6 +4859,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4812
4859
|
* @param pageItemAccumulator - accumulator to observe the current page from
|
|
4813
4860
|
* @returns observable emitting the most recently loaded page number
|
|
4814
4861
|
*/ function pageItemAccumulatorCurrentPage(pageItemAccumulator) {
|
|
4862
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4815
4863
|
return pageItemAccumulator.itemIteration.latestLoadedPage$;
|
|
4816
4864
|
}
|
|
4817
4865
|
|
|
@@ -5177,11 +5225,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5177
5225
|
hasNextPage: invertMaybeBoolean(end)
|
|
5178
5226
|
});
|
|
5179
5227
|
}
|
|
5180
|
-
|
|
5228
|
+
return {
|
|
5181
5229
|
n: request.n,
|
|
5182
5230
|
state: state
|
|
5183
5231
|
};
|
|
5184
|
-
return result;
|
|
5185
5232
|
}));
|
|
5186
5233
|
}), scan(function(acc, x) {
|
|
5187
5234
|
var n = x.n, curr = x.state;
|
|
@@ -5194,19 +5241,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5194
5241
|
lastSuccessful: acc.lastSuccessful
|
|
5195
5242
|
};
|
|
5196
5243
|
// If it was a replay of the previous result, change nothing.
|
|
5197
|
-
if (acc.current !== curr) {
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
if (!next.firstSuccessful) {
|
|
5207
|
-
next.firstSuccessful = curr;
|
|
5208
|
-
}
|
|
5209
|
-
}
|
|
5244
|
+
if (acc.current !== curr && isLoadingStateFinishedLoading(curr)) {
|
|
5245
|
+
var // only set first finished once
|
|
5246
|
+
_next, _firstFinished;
|
|
5247
|
+
(_firstFinished = (_next = next).firstFinished) !== null && _firstFinished !== void 0 ? _firstFinished : _next.firstFinished = curr;
|
|
5248
|
+
next.latestFinished = curr;
|
|
5249
|
+
if (!isLoadingStateWithError(curr)) {
|
|
5250
|
+
var _next1, _firstSuccessful;
|
|
5251
|
+
next.lastSuccessful = curr;
|
|
5252
|
+
(_firstSuccessful = (_next1 = next).firstSuccessful) !== null && _firstSuccessful !== void 0 ? _firstSuccessful : _next1.firstSuccessful = curr;
|
|
5210
5253
|
}
|
|
5211
5254
|
}
|
|
5212
5255
|
return next;
|
|
@@ -5515,6 +5558,10 @@ function _type_of(obj) {
|
|
|
5515
5558
|
* Useful for deferring an action until all locks are released, with a safety timeout to avoid waiting indefinitely.
|
|
5516
5559
|
*
|
|
5517
5560
|
* @param config - configuration specifying the lock set, callback, timeout, and optional delay
|
|
5561
|
+
* @param config.lockSet - the lock set to monitor for the next unlock event
|
|
5562
|
+
* @param config.fn - optional callback to invoke when the lock set unlocks or the timeout is reached
|
|
5563
|
+
* @param config.timeout - maximum time in milliseconds to wait before timing out
|
|
5564
|
+
* @param config.delayTime - optional delay in milliseconds after unlock before invoking the callback
|
|
5518
5565
|
* @returns subscription that can be unsubscribed to cancel the wait
|
|
5519
5566
|
*
|
|
5520
5567
|
* @example
|
|
@@ -5942,14 +5989,14 @@ function _define_property(obj, key, value) {
|
|
|
5942
5989
|
*
|
|
5943
5990
|
* If the loading state returns an error, the error is forwarded.
|
|
5944
5991
|
*
|
|
5945
|
-
* @param loadingStateObs
|
|
5992
|
+
* @param loadingStateObs - observable of the loading state to track as the work result
|
|
5946
5993
|
*/ key: "startWorkingWithLoadingStateObservable",
|
|
5947
5994
|
value: function startWorkingWithLoadingStateObservable(loadingStateObs) {
|
|
5948
5995
|
var _this = this;
|
|
5949
5996
|
var obs = preventComplete(loadingStateObs).pipe(filterMaybe(), shareReplay(1));
|
|
5950
5997
|
this._sub.subscription = obs.pipe(delay(0), first()).subscribe(function() {
|
|
5951
5998
|
_this.startWorkingWithObservable(obs.pipe(filter(function(x) {
|
|
5952
|
-
return
|
|
5999
|
+
return !isLoadingStateLoading(x);
|
|
5953
6000
|
}), map(function(x) {
|
|
5954
6001
|
if (x.error) {
|
|
5955
6002
|
throw x.error;
|
|
@@ -5968,11 +6015,12 @@ function _define_property(obj, key, value) {
|
|
|
5968
6015
|
*
|
|
5969
6016
|
* It is used in conjunction with startWorking() and ideal for cases where multiple observables or promises are used.
|
|
5970
6017
|
*
|
|
5971
|
-
* @param loadingStateObs
|
|
6018
|
+
* @param loadingStateObs - promise or observable of the loading state to track for errors
|
|
6019
|
+
* @returns a promise that resolves with the value from the loading state or rejects on error
|
|
5972
6020
|
*/ key: "performTaskWithLoadingState",
|
|
5973
6021
|
value: function performTaskWithLoadingState(loadingStateObs) {
|
|
5974
6022
|
var _this = this;
|
|
5975
|
-
return promiseFromLoadingState(from(loadingStateObs).pipe(filterMaybe(), tap(function(
|
|
6023
|
+
return promiseFromLoadingState(from(loadingStateObs).pipe(filterMaybe(), tap(function(_x) {
|
|
5976
6024
|
_this._setWorking(true); // mark as working if not already marked.
|
|
5977
6025
|
}))).catch(function(e) {
|
|
5978
6026
|
// catch and throw any errors.
|
|
@@ -5987,7 +6035,7 @@ function _define_property(obj, key, value) {
|
|
|
5987
6035
|
*
|
|
5988
6036
|
* If an error is thrown, the error is forwarded to the reject function.
|
|
5989
6037
|
*
|
|
5990
|
-
* @param fn
|
|
6038
|
+
* @param fn - synchronous function that returns the result value or throws an error
|
|
5991
6039
|
*/ key: "performTaskWithReturnValue",
|
|
5992
6040
|
value: function performTaskWithReturnValue(fn) {
|
|
5993
6041
|
try {
|
|
@@ -6002,6 +6050,8 @@ function _define_property(obj, key, value) {
|
|
|
6002
6050
|
{
|
|
6003
6051
|
/**
|
|
6004
6052
|
* Begins working using a promise.
|
|
6053
|
+
*
|
|
6054
|
+
* @param promise - the promise that represents the asynchronous work
|
|
6005
6055
|
*/ key: "startWorkingWithPromise",
|
|
6006
6056
|
value: function startWorkingWithPromise(promise) {
|
|
6007
6057
|
this.startWorkingWithObservable(from(promise));
|
|
@@ -6010,6 +6060,8 @@ function _define_property(obj, key, value) {
|
|
|
6010
6060
|
{
|
|
6011
6061
|
/**
|
|
6012
6062
|
* Begins working using an observable.
|
|
6063
|
+
*
|
|
6064
|
+
* @param workObs - the observable that represents the asynchronous work and emits the result
|
|
6013
6065
|
*/ key: "startWorkingWithObservable",
|
|
6014
6066
|
value: function startWorkingWithObservable(workObs) {
|
|
6015
6067
|
var _this = this;
|
|
@@ -6036,6 +6088,8 @@ function _define_property(obj, key, value) {
|
|
|
6036
6088
|
{
|
|
6037
6089
|
/**
|
|
6038
6090
|
* Sets success on the work.
|
|
6091
|
+
*
|
|
6092
|
+
* @param result - the successful result value to pass to the delegate
|
|
6039
6093
|
*/ key: "success",
|
|
6040
6094
|
value: function success(result) {
|
|
6041
6095
|
this._setComplete(successResult(result));
|
|
@@ -6045,6 +6099,8 @@ function _define_property(obj, key, value) {
|
|
|
6045
6099
|
{
|
|
6046
6100
|
/**
|
|
6047
6101
|
* Sets rejected on the work.
|
|
6102
|
+
*
|
|
6103
|
+
* @param error - the error to pass to the delegate as the rejection reason
|
|
6048
6104
|
*/ key: "reject",
|
|
6049
6105
|
value: function reject(error) {
|
|
6050
6106
|
this._setComplete(errorResult(error));
|
|
@@ -6106,6 +6162,8 @@ function _define_property(obj, key, value) {
|
|
|
6106
6162
|
* ```
|
|
6107
6163
|
*
|
|
6108
6164
|
* @param config - work function and delegate configuration
|
|
6165
|
+
* @param config.work - the work function to execute for each input value
|
|
6166
|
+
* @param config.delegate - delegate that receives lifecycle callbacks (start, success, reject)
|
|
6109
6167
|
* @returns a factory function that creates WorkInstance for each input
|
|
6110
6168
|
*/ function workFactory(param) {
|
|
6111
6169
|
var work = param.work, delegate = param.delegate;
|
|
@@ -6119,13 +6177,11 @@ function _define_property(obj, key, value) {
|
|
|
6119
6177
|
handler.reject(e);
|
|
6120
6178
|
return;
|
|
6121
6179
|
}
|
|
6122
|
-
if (!handler.isComplete) {
|
|
6123
|
-
if (
|
|
6124
|
-
|
|
6125
|
-
throw new Error('Work already marked as begun from returned result. Either return an observable or use the handler directly.');
|
|
6126
|
-
}
|
|
6127
|
-
handler.startWorkingWithObservable(fnResult);
|
|
6180
|
+
if (!handler.isComplete && fnResult && isObservable(fnResult)) {
|
|
6181
|
+
if (handler.hasStarted) {
|
|
6182
|
+
throw new Error('Work already marked as begun from returned result. Either return an observable or use the handler directly.');
|
|
6128
6183
|
}
|
|
6184
|
+
handler.startWorkingWithObservable(fnResult);
|
|
6129
6185
|
}
|
|
6130
6186
|
return handler;
|
|
6131
6187
|
};
|