@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.cjs.js
CHANGED
|
@@ -30,7 +30,7 @@ function asObservable(valueOrObs) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
function asObservableFromGetter(input, args) {
|
|
33
|
-
var obs = util.getValueFromGetter(input, args);
|
|
33
|
+
var obs = util.getValueFromGetter(input, args); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
34
34
|
return asObservable(obs);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -45,6 +45,8 @@ function asObservableFromGetter(input, args) {
|
|
|
45
45
|
/**
|
|
46
46
|
* RxJS operator that flattens an emitted Maybe<{@link ObservableOrValueGetter}> into its resolved value,
|
|
47
47
|
* emitting `undefined` when the input is nullish.
|
|
48
|
+
*
|
|
49
|
+
* @returns an operator that unwraps Maybe<ObservableOrValueGetter> emissions, emitting undefined for nullish inputs
|
|
48
50
|
*/ function maybeValueFromObservableOrValueGetter() {
|
|
49
51
|
return rxjs.switchMap(function(x) {
|
|
50
52
|
return x != null ? asObservableFromGetter(x) : rxjs.of(undefined);
|
|
@@ -139,6 +141,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
139
141
|
*
|
|
140
142
|
* @param isCheckFunction - optional check function
|
|
141
143
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
144
|
+
* @returns a function that evaluates each value against the check function and returns it or undefined
|
|
142
145
|
*/ function makeReturnIfIsFunction(isCheckFunction, defaultValueOnMaybe) {
|
|
143
146
|
return function(value) {
|
|
144
147
|
return returnIfIs(isCheckFunction, value, defaultValueOnMaybe);
|
|
@@ -150,6 +153,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
150
153
|
* @param isCheckFunction - optional check function
|
|
151
154
|
* @param value - the value to check
|
|
152
155
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
156
|
+
* @returns an observable that emits the value if the check passes, or undefined otherwise
|
|
153
157
|
*/ function returnIfIs(isCheckFunction, value, defaultValueOnMaybe) {
|
|
154
158
|
return checkIs(isCheckFunction, value, defaultValueOnMaybe).pipe(rxjs.map(function(x) {
|
|
155
159
|
return x ? value : undefined;
|
|
@@ -160,6 +164,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
160
164
|
*
|
|
161
165
|
* @param isCheckFunction - optional check function
|
|
162
166
|
* @param defaultValueOnMaybe - default result for null/undefined values
|
|
167
|
+
* @returns a function that evaluates each value against the check function and returns an observable boolean
|
|
163
168
|
*/ function makeCheckIsFunction(isCheckFunction, defaultValueOnMaybe) {
|
|
164
169
|
return function(value) {
|
|
165
170
|
return checkIs(isCheckFunction, value, defaultValueOnMaybe);
|
|
@@ -173,6 +178,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
173
178
|
* @param isCheckFunction - optional check function
|
|
174
179
|
* @param value - the value to check
|
|
175
180
|
* @param defaultValueOnMaybe - default result for null/undefined values (defaults to false)
|
|
181
|
+
* @returns an observable boolean indicating whether the value passes the check
|
|
176
182
|
*/ function checkIs(isCheckFunction, value) {
|
|
177
183
|
var defaultValueOnMaybe = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
178
184
|
var is = isCheckFunction ? value != null ? isCheckFunction(value) : rxjs.of(defaultValueOnMaybe) : rxjs.of(true);
|
|
@@ -181,6 +187,8 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
181
187
|
// MARK: Filter
|
|
182
188
|
/**
|
|
183
189
|
* RxJS operator that filters out null and undefined values, only passing through defined values.
|
|
190
|
+
*
|
|
191
|
+
* @returns operator that filters out null and undefined emissions
|
|
184
192
|
*/ function filterMaybe() {
|
|
185
193
|
return rxjs.filter(util.isMaybeSo);
|
|
186
194
|
}
|
|
@@ -189,11 +197,15 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
189
197
|
*/ var filterMaybeStrict = filterMaybe;
|
|
190
198
|
/**
|
|
191
199
|
* RxJS operator that filters out null/undefined elements from an emitted array, keeping only defined values.
|
|
200
|
+
*
|
|
201
|
+
* @returns operator that maps each emitted array to a version with null/undefined elements removed
|
|
192
202
|
*/ function filterMaybeArray() {
|
|
193
203
|
return rxjs.map(util.filterMaybeArrayValues);
|
|
194
204
|
}
|
|
195
205
|
/**
|
|
196
206
|
* RxJS operator that skips all leading null/undefined emissions, then passes all subsequent values through.
|
|
207
|
+
*
|
|
208
|
+
* @returns operator that skips all null/undefined emissions at the start of the stream
|
|
197
209
|
*/ function skipAllInitialMaybe() {
|
|
198
210
|
return rxjs.skipWhile(function(x) {
|
|
199
211
|
return x == null;
|
|
@@ -201,6 +213,8 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
201
213
|
}
|
|
202
214
|
/**
|
|
203
215
|
* RxJS operator that skips only the first emission if it is null/undefined, then passes all subsequent values.
|
|
216
|
+
*
|
|
217
|
+
* @returns operator that skips the first null/undefined emission if it occurs at the start of the stream
|
|
204
218
|
*/ function skipInitialMaybe() {
|
|
205
219
|
return skipMaybes(1);
|
|
206
220
|
}
|
|
@@ -208,6 +222,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
208
222
|
* RxJS operator that skips up to `maxToSkip` null/undefined emissions, then passes all subsequent values.
|
|
209
223
|
*
|
|
210
224
|
* @param maxToSkip - maximum number of null/undefined emissions to skip
|
|
225
|
+
* @returns operator that skips the first N null/undefined emissions from the stream
|
|
211
226
|
*/ function skipMaybes(maxToSkip) {
|
|
212
227
|
return rxjs.skipWhile(function(x, i) {
|
|
213
228
|
return x == null && i < maxToSkip;
|
|
@@ -229,7 +244,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
229
244
|
});
|
|
230
245
|
}
|
|
231
246
|
function switchMapToDefault(defaultObs, useDefault) {
|
|
232
|
-
var useDefaultFn = useDefault ? useDefault : function(x) {
|
|
247
|
+
var useDefaultFn = useDefault !== null && useDefault !== void 0 ? useDefault : function(x) {
|
|
233
248
|
return rxjs.of(x == null);
|
|
234
249
|
};
|
|
235
250
|
return rxjs.switchMap(function(x) {
|
|
@@ -245,6 +260,9 @@ function switchMapToDefault(defaultObs, useDefault) {
|
|
|
245
260
|
/**
|
|
246
261
|
* RxJS operator that resolves an observable/getter config input into a value, applying defaults
|
|
247
262
|
* for `null`/`undefined`/`true` inputs and emitting `null` for `false`.
|
|
263
|
+
*
|
|
264
|
+
* @param config - configuration providing an optional default getter for null/undefined/true inputs
|
|
265
|
+
* @returns operator that resolves each emitted getter into a value, using the default for nullish or true inputs
|
|
248
266
|
*/ function switchMapObject(config) {
|
|
249
267
|
var defaultGetter = config.defaultGetter;
|
|
250
268
|
return rxjs.switchMap(function(inputConfig) {
|
|
@@ -279,6 +297,8 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
279
297
|
* RxJS operator that filters out null/undefined observables and then switches to the remaining ones.
|
|
280
298
|
*
|
|
281
299
|
* Combines {@link filterMaybe} and `switchMap` to only subscribe to non-nullish observables.
|
|
300
|
+
*
|
|
301
|
+
* @returns operator that filters nullish observables and subscribes to the non-nullish ones
|
|
282
302
|
*/ function switchMapFilterMaybe() {
|
|
283
303
|
return function(source) {
|
|
284
304
|
var subscriber = source.pipe(filterMaybe(), rxjs.switchMap(function(x) {
|
|
@@ -289,10 +309,12 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
289
309
|
}
|
|
290
310
|
/**
|
|
291
311
|
* RxJS operator that switches to the emitted observable if defined, or emits `undefined` when the observable is nullish.
|
|
312
|
+
*
|
|
313
|
+
* @returns operator that switches to the emitted observable or emits undefined for null/undefined inputs
|
|
292
314
|
*/ function switchMapMaybe() {
|
|
293
315
|
return function(source) {
|
|
294
316
|
var subscriber = source.pipe(rxjs.switchMap(function(x) {
|
|
295
|
-
return x
|
|
317
|
+
return x !== null && x !== void 0 ? x : rxjs.of(undefined);
|
|
296
318
|
}));
|
|
297
319
|
return subscriber;
|
|
298
320
|
};
|
|
@@ -317,11 +339,11 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
317
339
|
});
|
|
318
340
|
}
|
|
319
341
|
/**
|
|
320
|
-
* Combines
|
|
342
|
+
* Combines the source observable with another observable via `combineLatest`, then maps the pair to a result.
|
|
321
343
|
*
|
|
322
|
-
* @param combineObs
|
|
323
|
-
* @param mapFn
|
|
324
|
-
* @returns
|
|
344
|
+
* @param combineObs - the secondary observable to combine with the source
|
|
345
|
+
* @param mapFn - function that maps the source value and combined value to the output
|
|
346
|
+
* @returns operator that combines the source with `combineObs` and maps each pair using `mapFn`
|
|
325
347
|
*/ function combineLatestMapFrom(combineObs, mapFn) {
|
|
326
348
|
return function(obs) {
|
|
327
349
|
return rxjs.combineLatest([
|
|
@@ -337,6 +359,11 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
337
359
|
* Creates an observable that emits a starting value, then a second value after a delay.
|
|
338
360
|
*
|
|
339
361
|
* If the delay is not provided, or is falsy, then the second value is never emitted.
|
|
362
|
+
*
|
|
363
|
+
* @param startWith - the value to emit immediately
|
|
364
|
+
* @param endWith - the value to emit after the delay
|
|
365
|
+
* @param delayTime - optional delay in milliseconds before emitting the second value
|
|
366
|
+
* @returns an observable that emits `startWith` immediately and `endWith` after the delay (if provided)
|
|
340
367
|
*/ function emitDelayObs(startWith, endWith, delayTime) {
|
|
341
368
|
var obs = rxjs.of(startWith);
|
|
342
369
|
if (delayTime) {
|
|
@@ -346,6 +373,10 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
346
373
|
}
|
|
347
374
|
/**
|
|
348
375
|
* Emits a value after a given delay after every new emission.
|
|
376
|
+
*
|
|
377
|
+
* @param value - the value to emit after the delay
|
|
378
|
+
* @param delayTime - duration in milliseconds before emitting the value
|
|
379
|
+
* @returns operator that appends the given value after each source emission with the specified delay
|
|
349
380
|
*/ function emitAfterDelay(value, delayTime) {
|
|
350
381
|
return function(obs) {
|
|
351
382
|
return obs.pipe(rxjs.switchMap(function(x) {
|
|
@@ -375,15 +406,12 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
|
|
|
375
406
|
});
|
|
376
407
|
}
|
|
377
408
|
function filterIfObjectValuesUnchanged(input) {
|
|
378
|
-
|
|
379
|
-
return
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return !util.areEqualPOJOValues(input, inputObject);
|
|
385
|
-
});
|
|
386
|
-
}
|
|
409
|
+
var result = rxjs.isObservable(input) ? rxjs.mergeMap(function(inputFilter) {
|
|
410
|
+
return input.pipe(filterIfObjectValuesUnchanged(inputFilter));
|
|
411
|
+
}) : rxjs.filter(function(inputObject) {
|
|
412
|
+
return !util.areEqualPOJOValues(input, inputObject);
|
|
413
|
+
});
|
|
414
|
+
return result;
|
|
387
415
|
}
|
|
388
416
|
|
|
389
417
|
function _array_like_to_array$a(arr, len) {
|
|
@@ -391,7 +419,7 @@ function _array_like_to_array$a(arr, len) {
|
|
|
391
419
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
392
420
|
return arr2;
|
|
393
421
|
}
|
|
394
|
-
function _array_without_holes$
|
|
422
|
+
function _array_without_holes$6(arr) {
|
|
395
423
|
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
396
424
|
}
|
|
397
425
|
function _class_call_check$8(instance, Constructor) {
|
|
@@ -425,14 +453,14 @@ function _define_property$c(obj, key, value) {
|
|
|
425
453
|
}
|
|
426
454
|
return obj;
|
|
427
455
|
}
|
|
428
|
-
function _iterable_to_array$
|
|
456
|
+
function _iterable_to_array$6(iter) {
|
|
429
457
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
430
458
|
}
|
|
431
|
-
function _non_iterable_spread$
|
|
459
|
+
function _non_iterable_spread$6() {
|
|
432
460
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
433
461
|
}
|
|
434
|
-
function _to_consumable_array$
|
|
435
|
-
return _array_without_holes$
|
|
462
|
+
function _to_consumable_array$6(arr) {
|
|
463
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$6();
|
|
436
464
|
}
|
|
437
465
|
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
438
466
|
if (!o) return;
|
|
@@ -472,6 +500,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
472
500
|
key: "hasSubscription",
|
|
473
501
|
get: /**
|
|
474
502
|
* Whether a subscription is currently being managed.
|
|
503
|
+
*
|
|
504
|
+
* @returns true if a subscription is currently active
|
|
475
505
|
*/ function get() {
|
|
476
506
|
return Boolean(this._subscription);
|
|
477
507
|
}
|
|
@@ -551,6 +581,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
551
581
|
key: "hasSubscription",
|
|
552
582
|
get: /**
|
|
553
583
|
* Whether any subscriptions are currently being managed.
|
|
584
|
+
*
|
|
585
|
+
* @returns true if one or more subscriptions are currently active
|
|
554
586
|
*/ function get() {
|
|
555
587
|
var _this__subscriptions;
|
|
556
588
|
return Boolean((_this__subscriptions = this._subscriptions) === null || _this__subscriptions === void 0 ? void 0 : _this__subscriptions.length);
|
|
@@ -583,7 +615,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
583
615
|
*/ key: "addSubs",
|
|
584
616
|
value: function addSubs(subs) {
|
|
585
617
|
var _this__subscriptions;
|
|
586
|
-
var nextSubscriptions = _to_consumable_array$
|
|
618
|
+
var nextSubscriptions = _to_consumable_array$6((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
|
|
587
619
|
util.convertToArray(subs).forEach(function(sub) {
|
|
588
620
|
if (!nextSubscriptions.includes(sub)) {
|
|
589
621
|
nextSubscriptions.push(sub);
|
|
@@ -816,24 +848,23 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
816
848
|
key: "initFilterTakesPriority",
|
|
817
849
|
value: function initFilterTakesPriority() {
|
|
818
850
|
var _this = this;
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
851
|
+
var _this__initialFilterSub, _subscription;
|
|
852
|
+
(_subscription = (_this__initialFilterSub = this._initialFilterSub).subscription) !== null && _subscription !== void 0 ? _subscription : _this__initialFilterSub.subscription = this._initialFilterTakesPriority.pipe(rxjs.switchMap(function(clearFilterOnInitialFilterPush) {
|
|
853
|
+
if (clearFilterOnInitialFilterPush) {
|
|
854
|
+
return _this._initialFilter.pipe(rxjs.switchMap(function(x) {
|
|
855
|
+
return x !== null && x !== void 0 ? x : rxjs.EMPTY;
|
|
856
|
+
}), filterMaybe(), rxjs.map(function() {
|
|
857
|
+
return true;
|
|
858
|
+
}), rxjs.skip(1) // skip the first emission
|
|
859
|
+
);
|
|
860
|
+
} else {
|
|
861
|
+
return rxjs.EMPTY;
|
|
862
|
+
}
|
|
863
|
+
}), rxjs.defaultIfEmpty(false)).subscribe(function(clear) {
|
|
864
|
+
if (clear) {
|
|
865
|
+
_this.resetFilter();
|
|
866
|
+
}
|
|
867
|
+
});
|
|
837
868
|
}
|
|
838
869
|
},
|
|
839
870
|
{
|
|
@@ -858,7 +889,7 @@ function _array_like_to_array$8(arr, len) {
|
|
|
858
889
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
859
890
|
return arr2;
|
|
860
891
|
}
|
|
861
|
-
function _array_without_holes$
|
|
892
|
+
function _array_without_holes$5(arr) {
|
|
862
893
|
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
863
894
|
}
|
|
864
895
|
function _class_call_check$6(instance, Constructor) {
|
|
@@ -892,14 +923,14 @@ function _define_property$a(obj, key, value) {
|
|
|
892
923
|
}
|
|
893
924
|
return obj;
|
|
894
925
|
}
|
|
895
|
-
function _iterable_to_array$
|
|
926
|
+
function _iterable_to_array$5(iter) {
|
|
896
927
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
897
928
|
}
|
|
898
|
-
function _non_iterable_spread$
|
|
929
|
+
function _non_iterable_spread$5() {
|
|
899
930
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
900
931
|
}
|
|
901
|
-
function _to_consumable_array$
|
|
902
|
-
return _array_without_holes$
|
|
932
|
+
function _to_consumable_array$5(arr) {
|
|
933
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$5();
|
|
903
934
|
}
|
|
904
935
|
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
905
936
|
if (!o) return;
|
|
@@ -1058,6 +1089,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1058
1089
|
{
|
|
1059
1090
|
/**
|
|
1060
1091
|
* Sets the default filter observable for this key.
|
|
1092
|
+
*
|
|
1093
|
+
* @param filterObs - the observable to use as the default filter for this key
|
|
1061
1094
|
*/ key: "initWithFilter",
|
|
1062
1095
|
value: function initWithFilter(filterObs) {
|
|
1063
1096
|
this.dbxFilterMap.addDefaultFilterObs(this.key, filterObs);
|
|
@@ -1066,6 +1099,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1066
1099
|
{
|
|
1067
1100
|
/**
|
|
1068
1101
|
* Connects a filter source, adding its filter observable to this key's merged filters.
|
|
1102
|
+
*
|
|
1103
|
+
* @param filterSource - the filter source whose filter$ will be added to this key's merged stream
|
|
1069
1104
|
*/ key: "connectWithSource",
|
|
1070
1105
|
value: function connectWithSource(filterSource) {
|
|
1071
1106
|
this.dbxFilterMap.addFilterObs(this.key, filterSource.filter$);
|
|
@@ -1083,7 +1118,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1083
1118
|
_define_property$a(this, "_source", new FilterSourceInstance());
|
|
1084
1119
|
_define_property$a(this, "_obs", new rxjs.BehaviorSubject([]));
|
|
1085
1120
|
_define_property$a(this, "_obs$", this._obs.pipe(rxjs.switchMap(function(x) {
|
|
1086
|
-
return rxjs.merge.apply(void 0, _to_consumable_array$
|
|
1121
|
+
return rxjs.merge.apply(void 0, _to_consumable_array$5(x.map(function(y) {
|
|
1087
1122
|
return y.obs;
|
|
1088
1123
|
})));
|
|
1089
1124
|
}), rxjs.distinctUntilChanged()));
|
|
@@ -1124,7 +1159,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1124
1159
|
var deleteOnComplete = obs.pipe(rxjs.finalize(function() {
|
|
1125
1160
|
_this._deleteFilterObs(i);
|
|
1126
1161
|
})).subscribe();
|
|
1127
|
-
var nextObs = _to_consumable_array$
|
|
1162
|
+
var nextObs = _to_consumable_array$5(currentObs).concat([
|
|
1128
1163
|
{
|
|
1129
1164
|
i: i,
|
|
1130
1165
|
obs: obs,
|
|
@@ -1531,17 +1566,17 @@ function _array_like_to_array$7(arr, len) {
|
|
|
1531
1566
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1532
1567
|
return arr2;
|
|
1533
1568
|
}
|
|
1534
|
-
function _array_without_holes$
|
|
1569
|
+
function _array_without_holes$4(arr) {
|
|
1535
1570
|
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
1536
1571
|
}
|
|
1537
|
-
function _iterable_to_array$
|
|
1572
|
+
function _iterable_to_array$4(iter) {
|
|
1538
1573
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1539
1574
|
}
|
|
1540
|
-
function _non_iterable_spread$
|
|
1575
|
+
function _non_iterable_spread$4() {
|
|
1541
1576
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1542
1577
|
}
|
|
1543
|
-
function _to_consumable_array$
|
|
1544
|
-
return _array_without_holes$
|
|
1578
|
+
function _to_consumable_array$4(arr) {
|
|
1579
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
|
|
1545
1580
|
}
|
|
1546
1581
|
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
1547
1582
|
if (!o) return;
|
|
@@ -1567,7 +1602,7 @@ function scanIntoArray() {
|
|
|
1567
1602
|
return rxjs.scan(function(acc, next) {
|
|
1568
1603
|
if (next != null) {
|
|
1569
1604
|
if (immutable) {
|
|
1570
|
-
acc = acc.concat(next);
|
|
1605
|
+
acc = _to_consumable_array$4(acc).concat(_to_consumable_array$4(util.asArray(next)));
|
|
1571
1606
|
} else {
|
|
1572
1607
|
acc = util.pushItemOrArrayItemsIntoArray(acc, next);
|
|
1573
1608
|
}
|
|
@@ -1597,7 +1632,7 @@ function scanIntoArray() {
|
|
|
1597
1632
|
}
|
|
1598
1633
|
return acc;
|
|
1599
1634
|
}, seed !== null && seed !== void 0 ? seed : []), distinctUntilArrayLengthChanges(), rxjs.map(function(x) {
|
|
1600
|
-
return _to_consumable_array$
|
|
1635
|
+
return _to_consumable_array$4(x);
|
|
1601
1636
|
}), rxjs.shareReplay(1));
|
|
1602
1637
|
});
|
|
1603
1638
|
}
|
|
@@ -1687,7 +1722,7 @@ function scanIntoArray() {
|
|
|
1687
1722
|
if (!acc.fromMatch || requireConsecutive) {
|
|
1688
1723
|
fromMatch = isMatch(from, next);
|
|
1689
1724
|
value = next;
|
|
1690
|
-
} else
|
|
1725
|
+
} else {
|
|
1691
1726
|
value = acc.value;
|
|
1692
1727
|
}
|
|
1693
1728
|
}
|
|
@@ -1721,6 +1756,8 @@ function scanIntoArray() {
|
|
|
1721
1756
|
}
|
|
1722
1757
|
/**
|
|
1723
1758
|
* RxJS operator that negates each emitted boolean value.
|
|
1759
|
+
*
|
|
1760
|
+
* @returns operator that maps each boolean emission to its negated value
|
|
1724
1761
|
*/ function isNot() {
|
|
1725
1762
|
return rxjs.map(function(x) {
|
|
1726
1763
|
return !x;
|
|
@@ -1728,6 +1765,8 @@ function scanIntoArray() {
|
|
|
1728
1765
|
}
|
|
1729
1766
|
/**
|
|
1730
1767
|
* RxJS operator that only emits when a boolean stream transitions from `true` to `false`.
|
|
1768
|
+
*
|
|
1769
|
+
* @returns operator that filters to only true-to-false transition emissions
|
|
1731
1770
|
*/ function onTrueToFalse() {
|
|
1732
1771
|
return onMatchDelta({
|
|
1733
1772
|
from: true,
|
|
@@ -1737,6 +1776,8 @@ function scanIntoArray() {
|
|
|
1737
1776
|
}
|
|
1738
1777
|
/**
|
|
1739
1778
|
* RxJS operator that only emits when a boolean stream transitions from `false` to `true`.
|
|
1779
|
+
*
|
|
1780
|
+
* @returns operator that filters to only false-to-true transition emissions
|
|
1740
1781
|
*/ function onFalseToTrue() {
|
|
1741
1782
|
return onMatchDelta({
|
|
1742
1783
|
from: false,
|
|
@@ -1755,6 +1796,7 @@ function scanIntoArray() {
|
|
|
1755
1796
|
* @returns the inverted (or original) decision function
|
|
1756
1797
|
*/ function invertObservableDecision(decisionFn) {
|
|
1757
1798
|
var invert = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1799
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1758
1800
|
if (invert) {
|
|
1759
1801
|
return function(value) {
|
|
1760
1802
|
var obs = decisionFn(value);
|
|
@@ -1809,7 +1851,7 @@ function scanIntoArray() {
|
|
|
1809
1851
|
* time relative to the current moment.
|
|
1810
1852
|
*
|
|
1811
1853
|
* @param expiresIn - duration in milliseconds until expiration
|
|
1812
|
-
* @returns an
|
|
1854
|
+
* @returns an `OperatorFunction` that maps each emission to an {@link Expires} object
|
|
1813
1855
|
*/ function toExpiration(expiresIn) {
|
|
1814
1856
|
return rxjs.map(function() {
|
|
1815
1857
|
var now = new Date();
|
|
@@ -1824,6 +1866,8 @@ function scanIntoArray() {
|
|
|
1824
1866
|
}
|
|
1825
1867
|
/**
|
|
1826
1868
|
* RxJS operator that filters out emissions whose {@link Expires} value has already expired.
|
|
1869
|
+
*
|
|
1870
|
+
* @returns operator that only passes through non-expired emissions
|
|
1827
1871
|
*/ function skipExpired() {
|
|
1828
1872
|
return rxjs.filter(function(expires) {
|
|
1829
1873
|
return !util.expirationDetails({
|
|
@@ -1835,6 +1879,7 @@ function scanIntoArray() {
|
|
|
1835
1879
|
* RxJS operator that skips emissions until the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1836
1880
|
*
|
|
1837
1881
|
* @param expiresIn - duration in milliseconds
|
|
1882
|
+
* @returns operator that skips emissions until the time window has elapsed
|
|
1838
1883
|
*/ function skipUntilExpiration(expiresIn) {
|
|
1839
1884
|
return rxjs.filter(function(x) {
|
|
1840
1885
|
return util.expirationDetails({
|
|
@@ -1847,6 +1892,7 @@ function scanIntoArray() {
|
|
|
1847
1892
|
* RxJS operator that skips emissions after the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1848
1893
|
*
|
|
1849
1894
|
* @param expiresIn - duration in milliseconds
|
|
1895
|
+
* @returns operator that passes through emissions only within the time window
|
|
1850
1896
|
*/ function skipAfterExpiration(expiresIn) {
|
|
1851
1897
|
return rxjs.filter(function(x) {
|
|
1852
1898
|
return !util.expirationDetails({
|
|
@@ -1860,6 +1906,7 @@ function scanIntoArray() {
|
|
|
1860
1906
|
*
|
|
1861
1907
|
* @param watch - observable whose emissions reset the time window
|
|
1862
1908
|
* @param takeFor - duration in milliseconds of each time window
|
|
1909
|
+
* @returns operator that limits source emissions to the active time window after each watch emission
|
|
1863
1910
|
*/ function skipUntilTimeElapsedAfterLastEmission(watch, takeFor) {
|
|
1864
1911
|
return function(observable) {
|
|
1865
1912
|
return watch.pipe(rxjs.switchMap(function() {
|
|
@@ -1879,6 +1926,7 @@ function scanIntoArray() {
|
|
|
1879
1926
|
*
|
|
1880
1927
|
* @param watch - observable whose emissions reset the skip window
|
|
1881
1928
|
* @param skipFor - duration in milliseconds to skip after each watch emission
|
|
1929
|
+
* @returns an operator that delays passing values through until time has elapsed since the last watch emission
|
|
1882
1930
|
*/ function takeAfterTimeElapsedSinceLastEmission(watch, skipFor) {
|
|
1883
1931
|
return function(observable) {
|
|
1884
1932
|
return watch.pipe(rxjs.switchMap(function() {
|
|
@@ -2030,7 +2078,7 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
|
|
|
2030
2078
|
return result;
|
|
2031
2079
|
}), rxjs.finalize(function() {
|
|
2032
2080
|
if (currentInstance) {
|
|
2033
|
-
destroy(currentInstance);
|
|
2081
|
+
void destroy(currentInstance);
|
|
2034
2082
|
}
|
|
2035
2083
|
}));
|
|
2036
2084
|
};
|
|
@@ -2106,6 +2154,8 @@ function tapLog(messageOrFunction) {
|
|
|
2106
2154
|
|
|
2107
2155
|
/**
|
|
2108
2156
|
* `distinctUntilChanged` variant that only emits when the model's `id` property changes.
|
|
2157
|
+
*
|
|
2158
|
+
* @returns operator that suppresses consecutive emissions with the same model `id`
|
|
2109
2159
|
*/ function distinctUntilModelIdChange() {
|
|
2110
2160
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2111
2161
|
return x.id;
|
|
@@ -2113,6 +2163,8 @@ function tapLog(messageOrFunction) {
|
|
|
2113
2163
|
}
|
|
2114
2164
|
/**
|
|
2115
2165
|
* `distinctUntilChanged` variant that only emits when the model's `key` property changes.
|
|
2166
|
+
*
|
|
2167
|
+
* @returns operator that suppresses consecutive emissions with the same model `key`
|
|
2116
2168
|
*/ function distinctUntilModelKeyChange() {
|
|
2117
2169
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2118
2170
|
return x.key;
|
|
@@ -2428,6 +2480,12 @@ function _array_like_to_array$5(arr, len) {
|
|
|
2428
2480
|
function _array_with_holes$2(arr) {
|
|
2429
2481
|
if (Array.isArray(arr)) return arr;
|
|
2430
2482
|
}
|
|
2483
|
+
function _array_without_holes$3(arr) {
|
|
2484
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
2485
|
+
}
|
|
2486
|
+
function _iterable_to_array$3(iter) {
|
|
2487
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2488
|
+
}
|
|
2431
2489
|
function _iterable_to_array_limit$2(arr, i) {
|
|
2432
2490
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2433
2491
|
if (_i == null) return;
|
|
@@ -2455,9 +2513,15 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
2455
2513
|
function _non_iterable_rest$2() {
|
|
2456
2514
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2457
2515
|
}
|
|
2516
|
+
function _non_iterable_spread$3() {
|
|
2517
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2518
|
+
}
|
|
2458
2519
|
function _sliced_to_array$2(arr, i) {
|
|
2459
2520
|
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
|
|
2460
2521
|
}
|
|
2522
|
+
function _to_consumable_array$3(arr) {
|
|
2523
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
|
|
2524
|
+
}
|
|
2461
2525
|
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2462
2526
|
if (!o) return;
|
|
2463
2527
|
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
@@ -2475,7 +2539,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2475
2539
|
*/ function combineLatestFromMapValuesObsFn(mapToObs) {
|
|
2476
2540
|
var combineArrayFn = combineLatestFromArrayObsFn(mapToObs);
|
|
2477
2541
|
return function(latestMap) {
|
|
2478
|
-
var mapValues =
|
|
2542
|
+
var mapValues = _to_consumable_array$3(latestMap).map(function(y) {
|
|
2479
2543
|
return y[1];
|
|
2480
2544
|
});
|
|
2481
2545
|
return combineArrayFn(mapValues);
|
|
@@ -2525,7 +2589,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2525
2589
|
var result = {};
|
|
2526
2590
|
latestValues.forEach(function(param) {
|
|
2527
2591
|
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
2528
|
-
result[key] = value;
|
|
2592
|
+
result[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
2529
2593
|
});
|
|
2530
2594
|
return result;
|
|
2531
2595
|
}));
|
|
@@ -2568,7 +2632,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2568
2632
|
*/ function errorOnEmissionsInPeriod(config) {
|
|
2569
2633
|
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;
|
|
2570
2634
|
var errorMessage = inputErrorMessage !== null && inputErrorMessage !== void 0 ? inputErrorMessage : 'errorOnEmissionsInPeriod(): Too many emissions in time period.';
|
|
2571
|
-
var errorFactory = inputErrorFactory ? inputErrorFactory : !switchToObs ? function() {
|
|
2635
|
+
var errorFactory = inputErrorFactory !== null && inputErrorFactory !== void 0 ? inputErrorFactory : !switchToObs ? function() {
|
|
2572
2636
|
return new Error(errorMessage);
|
|
2573
2637
|
} : undefined;
|
|
2574
2638
|
return function(source) {
|
|
@@ -2628,6 +2692,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2628
2692
|
}
|
|
2629
2693
|
/**
|
|
2630
2694
|
* `distinctUntilChanged` variant for iterables that only emits when the contained values change.
|
|
2695
|
+
*
|
|
2696
|
+
* @returns operator that suppresses consecutive iterable emissions with the same set of values
|
|
2631
2697
|
*/ function distinctUntilHasDifferentValues() {
|
|
2632
2698
|
return rxjs.distinctUntilChanged(util.hasSameValues);
|
|
2633
2699
|
}
|
|
@@ -2875,16 +2941,17 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2875
2941
|
* @param state - the loading state to check (may be null/undefined)
|
|
2876
2942
|
* @returns true if loading is complete
|
|
2877
2943
|
*/ function isLoadingStateFinishedLoading(state) {
|
|
2944
|
+
var result = false;
|
|
2878
2945
|
if (state) {
|
|
2879
2946
|
var loading = state.loading;
|
|
2880
2947
|
if (loading === true) {
|
|
2881
|
-
|
|
2948
|
+
result = false;
|
|
2882
2949
|
} else {
|
|
2883
|
-
|
|
2950
|
+
var _state_value;
|
|
2951
|
+
result = loading === false || Boolean((_state_value = state.value) !== null && _state_value !== void 0 ? _state_value : state.error) || state.value === null;
|
|
2884
2952
|
}
|
|
2885
|
-
} else {
|
|
2886
|
-
return false;
|
|
2887
2953
|
}
|
|
2954
|
+
return result;
|
|
2888
2955
|
}
|
|
2889
2956
|
/**
|
|
2890
2957
|
* Creates an idle {@link LoadingState} with `loading: false` and no value or error.
|
|
@@ -2897,6 +2964,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2897
2964
|
* // { loading: false }
|
|
2898
2965
|
* loadingStateType(state); // LoadingStateType.IDLE
|
|
2899
2966
|
* ```
|
|
2967
|
+
*
|
|
2968
|
+
* @returns a loading state with `loading: false` and no value or error
|
|
2900
2969
|
*/ function idleLoadingState() {
|
|
2901
2970
|
return {
|
|
2902
2971
|
loading: false
|
|
@@ -3021,11 +3090,7 @@ function beginLoading(state) {
|
|
|
3021
3090
|
*/ function isLoadingStateWithStateType(type) {
|
|
3022
3091
|
var defaultResult = type === exports.LoadingStateType.IDLE ? true : false;
|
|
3023
3092
|
return function(state) {
|
|
3024
|
-
|
|
3025
|
-
return loadingStateType(state) === type;
|
|
3026
|
-
} else {
|
|
3027
|
-
return defaultResult;
|
|
3028
|
-
}
|
|
3093
|
+
return state ? loadingStateType(state) === type : defaultResult;
|
|
3029
3094
|
};
|
|
3030
3095
|
}
|
|
3031
3096
|
/**
|
|
@@ -3068,11 +3133,7 @@ function beginLoading(state) {
|
|
|
3068
3133
|
* @param state - the loading state to check
|
|
3069
3134
|
* @returns true if the state has a defined (non-undefined) value
|
|
3070
3135
|
*/ function isLoadingStateWithDefinedValue(state) {
|
|
3071
|
-
|
|
3072
|
-
return state.value !== undefined;
|
|
3073
|
-
} else {
|
|
3074
|
-
return false;
|
|
3075
|
-
}
|
|
3136
|
+
return state ? state.value !== undefined : false;
|
|
3076
3137
|
}
|
|
3077
3138
|
/**
|
|
3078
3139
|
* Type guard that checks whether a {@link LoadingState} has a non-null error, regardless of loading status.
|
|
@@ -3086,11 +3147,7 @@ function beginLoading(state) {
|
|
|
3086
3147
|
* @param state - the loading state to check
|
|
3087
3148
|
* @returns true if the state has an error
|
|
3088
3149
|
*/ function isLoadingStateWithError(state) {
|
|
3089
|
-
|
|
3090
|
-
return state.error != null;
|
|
3091
|
-
} else {
|
|
3092
|
-
return false;
|
|
3093
|
-
}
|
|
3150
|
+
return state ? state.error != null : false;
|
|
3094
3151
|
}
|
|
3095
3152
|
/**
|
|
3096
3153
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has a defined value.
|
|
@@ -3098,11 +3155,7 @@ function beginLoading(state) {
|
|
|
3098
3155
|
* @param state - the loading state to check
|
|
3099
3156
|
* @returns true if finished loading with a non-undefined value
|
|
3100
3157
|
*/ function isLoadingStateFinishedLoadingWithDefinedValue(state) {
|
|
3101
|
-
|
|
3102
|
-
return isLoadingStateFinishedLoading(state) && state.value !== undefined;
|
|
3103
|
-
} else {
|
|
3104
|
-
return false;
|
|
3105
|
-
}
|
|
3158
|
+
return state ? isLoadingStateFinishedLoading(state) && state.value !== undefined : false;
|
|
3106
3159
|
}
|
|
3107
3160
|
/**
|
|
3108
3161
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has an error.
|
|
@@ -3110,11 +3163,7 @@ function beginLoading(state) {
|
|
|
3110
3163
|
* @param state - the loading state to check
|
|
3111
3164
|
* @returns true if finished loading with an error
|
|
3112
3165
|
*/ function isLoadingStateFinishedLoadingWithError(state) {
|
|
3113
|
-
|
|
3114
|
-
return isLoadingStateFinishedLoading(state) && state.error != null;
|
|
3115
|
-
} else {
|
|
3116
|
-
return false;
|
|
3117
|
-
}
|
|
3166
|
+
return state ? isLoadingStateFinishedLoading(state) && state.error != null : false;
|
|
3118
3167
|
}
|
|
3119
3168
|
/**
|
|
3120
3169
|
* Compares the metadata (page, loading, error) of two {@link PageLoadingState} instances for equivalence.
|
|
@@ -3145,15 +3194,16 @@ function mergeLoadingStates() {
|
|
|
3145
3194
|
args[_key] = arguments[_key];
|
|
3146
3195
|
}
|
|
3147
3196
|
var _loadingStates_find;
|
|
3148
|
-
|
|
3197
|
+
// eslint-disable-line jsdoc/require-jsdoc -- JSDoc is on the overload signatures above
|
|
3198
|
+
/* eslint-enable @typescript-eslint/max-params, @typescript-eslint/no-explicit-any */ var validArgs = util.filterMaybeArrayValues(args); // filter out any undefined values
|
|
3149
3199
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3150
|
-
var loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
|
|
3200
|
+
var loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3151
3201
|
var mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : function() {
|
|
3152
3202
|
for(var _len = arguments.length, inputArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3153
3203
|
inputArgs[_key] = arguments[_key];
|
|
3154
3204
|
}
|
|
3155
3205
|
return util.mergeObjects(inputArgs);
|
|
3156
|
-
};
|
|
3206
|
+
}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3157
3207
|
var error = (_loadingStates_find = loadingStates.find(function(x) {
|
|
3158
3208
|
return x.error;
|
|
3159
3209
|
})) === null || _loadingStates_find === void 0 ? void 0 : _loadingStates_find.error; // find the first error
|
|
@@ -3161,7 +3211,7 @@ function mergeLoadingStates() {
|
|
|
3161
3211
|
if (error) {
|
|
3162
3212
|
// ignore all loading states, except for any error-prone item that is still loading
|
|
3163
3213
|
var currentLoadings = loadingStates.map(function(x) {
|
|
3164
|
-
return
|
|
3214
|
+
return x.error ? x.loading : false;
|
|
3165
3215
|
});
|
|
3166
3216
|
var nonMaybeLoadings = currentLoadings.filter(function(x) {
|
|
3167
3217
|
return x != null;
|
|
@@ -3247,10 +3297,10 @@ function mergeLoadingStates() {
|
|
|
3247
3297
|
var mapValues = config.mapValues, mapState = config.mapState;
|
|
3248
3298
|
var loading = isAnyLoadingStateInLoadingState(input);
|
|
3249
3299
|
var error = input.map(function(x) {
|
|
3250
|
-
return x
|
|
3251
|
-
}).
|
|
3300
|
+
return x.error;
|
|
3301
|
+
}).find(function(x) {
|
|
3252
3302
|
return Boolean(x);
|
|
3253
|
-
})
|
|
3303
|
+
});
|
|
3254
3304
|
var result;
|
|
3255
3305
|
if (!error && !loading) {
|
|
3256
3306
|
if (mapValues) {
|
|
@@ -3272,7 +3322,7 @@ function mergeLoadingStates() {
|
|
|
3272
3322
|
}
|
|
3273
3323
|
function mapLoadingStateResults(input, config) {
|
|
3274
3324
|
var mapValue = config.mapValue, mapState = config.mapState, _config_alwaysMapValue = config.alwaysMapValue, alwaysMapValue = _config_alwaysMapValue === void 0 ? false : _config_alwaysMapValue;
|
|
3275
|
-
var inputValue = input
|
|
3325
|
+
var inputValue = input.value;
|
|
3276
3326
|
var value;
|
|
3277
3327
|
if ((inputValue != null || alwaysMapValue) && mapValue) {
|
|
3278
3328
|
value = mapValue(inputValue, input);
|
|
@@ -3412,24 +3462,20 @@ function combineLoadingStates() {
|
|
|
3412
3462
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3413
3463
|
args[_key] = arguments[_key];
|
|
3414
3464
|
}
|
|
3415
|
-
|
|
3465
|
+
// eslint-disable-line jsdoc/require-jsdoc -- JSDoc is on the overload signatures above
|
|
3466
|
+
/* eslint-enable @typescript-eslint/max-params, @typescript-eslint/no-explicit-any */ var validArgs = util.filterMaybeArrayValues(args); // filter out any undefined values
|
|
3416
3467
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3417
|
-
var obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
|
|
3468
|
+
var obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3418
3469
|
var mergeFn = lastValueIsMergeFn ? validArgs[validArgs.length - 1] : undefined;
|
|
3419
3470
|
return rxjs.combineLatest(obsArgs).pipe(rxjs.distinctUntilChanged(function(x, y) {
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
}) === -1;
|
|
3424
|
-
return hasSameValues;
|
|
3425
|
-
} else {
|
|
3426
|
-
return x === y;
|
|
3427
|
-
}
|
|
3471
|
+
return !x.some(function(_, i) {
|
|
3472
|
+
return x[i] !== y[i];
|
|
3473
|
+
});
|
|
3428
3474
|
}), rxjs.map(function(states) {
|
|
3429
|
-
|
|
3475
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3476
|
+
return mergeLoadingStates.apply(void 0, _to_consumable_array$1(states).concat([
|
|
3430
3477
|
mergeFn
|
|
3431
3478
|
]));
|
|
3432
|
-
return result;
|
|
3433
3479
|
}), rxjs.shareReplay(1) // Share the result.
|
|
3434
3480
|
);
|
|
3435
3481
|
}
|
|
@@ -3456,6 +3502,7 @@ function combineLoadingStates() {
|
|
|
3456
3502
|
* @param sources - An array of LoadingState observables to combine.
|
|
3457
3503
|
* @returns An observable emitting a {@link LoadingState}<boolean> representing the combined status.
|
|
3458
3504
|
*/ function combineLoadingStatesStatus(sources) {
|
|
3505
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3459
3506
|
return rxjs.combineLatest(sources).pipe(rxjs.map(function(allLoadingStates) {
|
|
3460
3507
|
var firstErrorState = allLoadingStates.find(function(x) {
|
|
3461
3508
|
return x.error;
|
|
@@ -3464,7 +3511,7 @@ function combineLoadingStates() {
|
|
|
3464
3511
|
if (firstErrorState) {
|
|
3465
3512
|
result = errorResult(firstErrorState.error);
|
|
3466
3513
|
} else {
|
|
3467
|
-
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.
|
|
3514
|
+
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.some(isLoadingStateLoading);
|
|
3468
3515
|
if (oneOrMoreStatesAreCurrentlyLoading) {
|
|
3469
3516
|
result = beginLoading(); // still loading
|
|
3470
3517
|
} else {
|
|
@@ -3592,7 +3639,7 @@ function tapOnLoadingStateType(fn, type) {
|
|
|
3592
3639
|
};
|
|
3593
3640
|
}
|
|
3594
3641
|
return rxjs.tap(function(state) {
|
|
3595
|
-
if (
|
|
3642
|
+
if (decisionFunction(state)) {
|
|
3596
3643
|
fn(state);
|
|
3597
3644
|
}
|
|
3598
3645
|
});
|
|
@@ -3744,6 +3791,10 @@ function distinctLoadingState(inputConfig) {
|
|
|
3744
3791
|
*
|
|
3745
3792
|
* Determines the `loading` flag based on whether an error is present, whether the value is defined,
|
|
3746
3793
|
* and the `showLoadingOnUndefinedValue` setting. Loading progress is only included while loading.
|
|
3794
|
+
*
|
|
3795
|
+
* @param state - the current loading state to convert into a context event
|
|
3796
|
+
* @param input - configuration input controlling how the loading flag is derived
|
|
3797
|
+
* @returns a loading state context event derived from the given state
|
|
3747
3798
|
*/ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION(state, input) {
|
|
3748
3799
|
var showLoadingOnUndefinedValue = input.showLoadingOnUndefinedValue;
|
|
3749
3800
|
var error = state.error, value = state.value, loadingProgress = state.loadingProgress;
|
|
@@ -3814,7 +3865,7 @@ function distinctLoadingState(inputConfig) {
|
|
|
3814
3865
|
return result;
|
|
3815
3866
|
}), rxjs.distinctUntilChanged(isLoadingStateEqual), rxjs.shareReplay(1));
|
|
3816
3867
|
var currentState$ = currentStateStream$.pipe(rxjs.switchMap(function(x) {
|
|
3817
|
-
return x ? x : rxjs.of(undefined);
|
|
3868
|
+
return x !== null && x !== void 0 ? x : rxjs.of(undefined);
|
|
3818
3869
|
}));
|
|
3819
3870
|
var state$ = currentState$.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
3820
3871
|
var loading$ = eventStream$.pipe(rxjs.map(isLoadingStateLoading));
|
|
@@ -3858,7 +3909,8 @@ function distinctLoadingState(inputConfig) {
|
|
|
3858
3909
|
* @param listLoadingState - the list loading state to check
|
|
3859
3910
|
* @returns true if the value is empty or absent
|
|
3860
3911
|
*/ function isListLoadingStateWithEmptyValue(listLoadingState) {
|
|
3861
|
-
|
|
3912
|
+
var _listLoadingState_value;
|
|
3913
|
+
return Boolean(!((_listLoadingState_value = listLoadingState.value) === null || _listLoadingState_value === void 0 ? void 0 : _listLoadingState_value.length));
|
|
3862
3914
|
}
|
|
3863
3915
|
/**
|
|
3864
3916
|
* RxJS operator that maps each emitted {@link ListLoadingState} to a boolean indicating whether the list is empty.
|
|
@@ -4140,6 +4192,8 @@ function _object_spread_props$3(target, source) {
|
|
|
4140
4192
|
{
|
|
4141
4193
|
/**
|
|
4142
4194
|
* Whether the current state has a non-null error.
|
|
4195
|
+
*
|
|
4196
|
+
* @returns true if the current state contains an error
|
|
4143
4197
|
*/ key: "hasError",
|
|
4144
4198
|
value: function hasError() {
|
|
4145
4199
|
return isLoadingStateWithError(this._subject.value);
|
|
@@ -4632,55 +4686,48 @@ function itemAccumulator(itemIteration, inputMapItem) {
|
|
|
4632
4686
|
return rxjs.from(util.asPromise(countResults(allItems)));
|
|
4633
4687
|
})).subscribe({
|
|
4634
4688
|
next: function next(currentResultsCount) {
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
result = _state.sent();
|
|
4651
|
-
currentResultsCount = result.currentCount;
|
|
4652
|
-
return [
|
|
4653
|
-
2,
|
|
4654
|
-
result.shouldContinue
|
|
4655
|
-
];
|
|
4656
|
-
}
|
|
4657
|
-
});
|
|
4658
|
-
})();
|
|
4659
|
-
},
|
|
4660
|
-
next: function next() {
|
|
4661
|
-
return _async_to_generator(function() {
|
|
4662
|
-
return _ts_generator(this, function(_state) {
|
|
4689
|
+
util.performTaskLoop({
|
|
4690
|
+
initValue: currentResultsCount,
|
|
4691
|
+
checkContinue: function checkContinue(_x, _i) {
|
|
4692
|
+
return _async_to_generator(function() {
|
|
4693
|
+
var result;
|
|
4694
|
+
return _ts_generator(this, function(_state) {
|
|
4695
|
+
switch(_state.label){
|
|
4696
|
+
case 0:
|
|
4697
|
+
return [
|
|
4698
|
+
4,
|
|
4699
|
+
checkResultsLimit()
|
|
4700
|
+
];
|
|
4701
|
+
case 1:
|
|
4702
|
+
result = _state.sent();
|
|
4703
|
+
currentResultsCount = result.currentCount;
|
|
4663
4704
|
return [
|
|
4664
4705
|
2,
|
|
4665
|
-
|
|
4706
|
+
result.shouldContinue
|
|
4666
4707
|
];
|
|
4667
|
-
|
|
4668
|
-
})();
|
|
4669
|
-
}
|
|
4670
|
-
}).then(function(page) {
|
|
4671
|
-
resolve({
|
|
4672
|
-
page: page,
|
|
4673
|
-
resultsCount: currentResultsCount
|
|
4708
|
+
}
|
|
4674
4709
|
});
|
|
4675
|
-
})
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4710
|
+
})();
|
|
4711
|
+
},
|
|
4712
|
+
next: function next() {
|
|
4713
|
+
return _async_to_generator(function() {
|
|
4714
|
+
return _ts_generator(this, function(_state) {
|
|
4715
|
+
return [
|
|
4716
|
+
2,
|
|
4717
|
+
accumulator.itemIteration.nextPage()
|
|
4718
|
+
];
|
|
4719
|
+
});
|
|
4720
|
+
})();
|
|
4721
|
+
}
|
|
4722
|
+
}).then(function(page) {
|
|
4723
|
+
resolve({
|
|
4724
|
+
page: page,
|
|
4725
|
+
resultsCount: currentResultsCount
|
|
4682
4726
|
});
|
|
4683
|
-
})()
|
|
4727
|
+
}).catch(function(error) {
|
|
4728
|
+
reject(error);
|
|
4729
|
+
throw error;
|
|
4730
|
+
});
|
|
4684
4731
|
},
|
|
4685
4732
|
error: function error(error) {
|
|
4686
4733
|
reject(error);
|
|
@@ -4747,7 +4794,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4747
4794
|
return accumulator.currentAllItemPairs$.pipe(scanBuildArray(function(allItems) {
|
|
4748
4795
|
var pairs = allItems;
|
|
4749
4796
|
var firstLatestItemPair = util.lastValue(allItems);
|
|
4750
|
-
var skipValue = firstLatestItemPair === null || firstLatestItemPair === void 0 ? void 0 : firstLatestItemPair.input;
|
|
4797
|
+
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
|
|
4751
4798
|
var seed = util.flattenArray(pairs.map(function(x) {
|
|
4752
4799
|
return x.output;
|
|
4753
4800
|
}));
|
|
@@ -4814,6 +4861,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4814
4861
|
* @param pageItemAccumulator - accumulator to observe the current page from
|
|
4815
4862
|
* @returns observable emitting the most recently loaded page number
|
|
4816
4863
|
*/ function pageItemAccumulatorCurrentPage(pageItemAccumulator) {
|
|
4864
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4817
4865
|
return pageItemAccumulator.itemIteration.latestLoadedPage$;
|
|
4818
4866
|
}
|
|
4819
4867
|
|
|
@@ -5179,11 +5227,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5179
5227
|
hasNextPage: util.invertMaybeBoolean(end)
|
|
5180
5228
|
});
|
|
5181
5229
|
}
|
|
5182
|
-
|
|
5230
|
+
return {
|
|
5183
5231
|
n: request.n,
|
|
5184
5232
|
state: state
|
|
5185
5233
|
};
|
|
5186
|
-
return result;
|
|
5187
5234
|
}));
|
|
5188
5235
|
}), rxjs.scan(function(acc, x) {
|
|
5189
5236
|
var n = x.n, curr = x.state;
|
|
@@ -5196,19 +5243,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5196
5243
|
lastSuccessful: acc.lastSuccessful
|
|
5197
5244
|
};
|
|
5198
5245
|
// If it was a replay of the previous result, change nothing.
|
|
5199
|
-
if (acc.current !== curr) {
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
if (!next.firstSuccessful) {
|
|
5209
|
-
next.firstSuccessful = curr;
|
|
5210
|
-
}
|
|
5211
|
-
}
|
|
5246
|
+
if (acc.current !== curr && isLoadingStateFinishedLoading(curr)) {
|
|
5247
|
+
var // only set first finished once
|
|
5248
|
+
_next, _firstFinished;
|
|
5249
|
+
(_firstFinished = (_next = next).firstFinished) !== null && _firstFinished !== void 0 ? _firstFinished : _next.firstFinished = curr;
|
|
5250
|
+
next.latestFinished = curr;
|
|
5251
|
+
if (!isLoadingStateWithError(curr)) {
|
|
5252
|
+
var _next1, _firstSuccessful;
|
|
5253
|
+
next.lastSuccessful = curr;
|
|
5254
|
+
(_firstSuccessful = (_next1 = next).firstSuccessful) !== null && _firstSuccessful !== void 0 ? _firstSuccessful : _next1.firstSuccessful = curr;
|
|
5212
5255
|
}
|
|
5213
5256
|
}
|
|
5214
5257
|
return next;
|
|
@@ -5517,6 +5560,10 @@ function _type_of(obj) {
|
|
|
5517
5560
|
* Useful for deferring an action until all locks are released, with a safety timeout to avoid waiting indefinitely.
|
|
5518
5561
|
*
|
|
5519
5562
|
* @param config - configuration specifying the lock set, callback, timeout, and optional delay
|
|
5563
|
+
* @param config.lockSet - the lock set to monitor for the next unlock event
|
|
5564
|
+
* @param config.fn - optional callback to invoke when the lock set unlocks or the timeout is reached
|
|
5565
|
+
* @param config.timeout - maximum time in milliseconds to wait before timing out
|
|
5566
|
+
* @param config.delayTime - optional delay in milliseconds after unlock before invoking the callback
|
|
5520
5567
|
* @returns subscription that can be unsubscribed to cancel the wait
|
|
5521
5568
|
*
|
|
5522
5569
|
* @example
|
|
@@ -5944,14 +5991,14 @@ function _define_property(obj, key, value) {
|
|
|
5944
5991
|
*
|
|
5945
5992
|
* If the loading state returns an error, the error is forwarded.
|
|
5946
5993
|
*
|
|
5947
|
-
* @param loadingStateObs
|
|
5994
|
+
* @param loadingStateObs - observable of the loading state to track as the work result
|
|
5948
5995
|
*/ key: "startWorkingWithLoadingStateObservable",
|
|
5949
5996
|
value: function startWorkingWithLoadingStateObservable(loadingStateObs) {
|
|
5950
5997
|
var _this = this;
|
|
5951
5998
|
var obs = preventComplete(loadingStateObs).pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
5952
5999
|
this._sub.subscription = obs.pipe(rxjs.delay(0), rxjs.first()).subscribe(function() {
|
|
5953
6000
|
_this.startWorkingWithObservable(obs.pipe(rxjs.filter(function(x) {
|
|
5954
|
-
return
|
|
6001
|
+
return !isLoadingStateLoading(x);
|
|
5955
6002
|
}), rxjs.map(function(x) {
|
|
5956
6003
|
if (x.error) {
|
|
5957
6004
|
throw x.error;
|
|
@@ -5970,11 +6017,12 @@ function _define_property(obj, key, value) {
|
|
|
5970
6017
|
*
|
|
5971
6018
|
* It is used in conjunction with startWorking() and ideal for cases where multiple observables or promises are used.
|
|
5972
6019
|
*
|
|
5973
|
-
* @param loadingStateObs
|
|
6020
|
+
* @param loadingStateObs - promise or observable of the loading state to track for errors
|
|
6021
|
+
* @returns a promise that resolves with the value from the loading state or rejects on error
|
|
5974
6022
|
*/ key: "performTaskWithLoadingState",
|
|
5975
6023
|
value: function performTaskWithLoadingState(loadingStateObs) {
|
|
5976
6024
|
var _this = this;
|
|
5977
|
-
return promiseFromLoadingState(rxjs.from(loadingStateObs).pipe(filterMaybe(), rxjs.tap(function(
|
|
6025
|
+
return promiseFromLoadingState(rxjs.from(loadingStateObs).pipe(filterMaybe(), rxjs.tap(function(_x) {
|
|
5978
6026
|
_this._setWorking(true); // mark as working if not already marked.
|
|
5979
6027
|
}))).catch(function(e) {
|
|
5980
6028
|
// catch and throw any errors.
|
|
@@ -5989,7 +6037,7 @@ function _define_property(obj, key, value) {
|
|
|
5989
6037
|
*
|
|
5990
6038
|
* If an error is thrown, the error is forwarded to the reject function.
|
|
5991
6039
|
*
|
|
5992
|
-
* @param fn
|
|
6040
|
+
* @param fn - synchronous function that returns the result value or throws an error
|
|
5993
6041
|
*/ key: "performTaskWithReturnValue",
|
|
5994
6042
|
value: function performTaskWithReturnValue(fn) {
|
|
5995
6043
|
try {
|
|
@@ -6004,6 +6052,8 @@ function _define_property(obj, key, value) {
|
|
|
6004
6052
|
{
|
|
6005
6053
|
/**
|
|
6006
6054
|
* Begins working using a promise.
|
|
6055
|
+
*
|
|
6056
|
+
* @param promise - the promise that represents the asynchronous work
|
|
6007
6057
|
*/ key: "startWorkingWithPromise",
|
|
6008
6058
|
value: function startWorkingWithPromise(promise) {
|
|
6009
6059
|
this.startWorkingWithObservable(rxjs.from(promise));
|
|
@@ -6012,6 +6062,8 @@ function _define_property(obj, key, value) {
|
|
|
6012
6062
|
{
|
|
6013
6063
|
/**
|
|
6014
6064
|
* Begins working using an observable.
|
|
6065
|
+
*
|
|
6066
|
+
* @param workObs - the observable that represents the asynchronous work and emits the result
|
|
6015
6067
|
*/ key: "startWorkingWithObservable",
|
|
6016
6068
|
value: function startWorkingWithObservable(workObs) {
|
|
6017
6069
|
var _this = this;
|
|
@@ -6038,6 +6090,8 @@ function _define_property(obj, key, value) {
|
|
|
6038
6090
|
{
|
|
6039
6091
|
/**
|
|
6040
6092
|
* Sets success on the work.
|
|
6093
|
+
*
|
|
6094
|
+
* @param result - the successful result value to pass to the delegate
|
|
6041
6095
|
*/ key: "success",
|
|
6042
6096
|
value: function success(result) {
|
|
6043
6097
|
this._setComplete(successResult(result));
|
|
@@ -6047,6 +6101,8 @@ function _define_property(obj, key, value) {
|
|
|
6047
6101
|
{
|
|
6048
6102
|
/**
|
|
6049
6103
|
* Sets rejected on the work.
|
|
6104
|
+
*
|
|
6105
|
+
* @param error - the error to pass to the delegate as the rejection reason
|
|
6050
6106
|
*/ key: "reject",
|
|
6051
6107
|
value: function reject(error) {
|
|
6052
6108
|
this._setComplete(errorResult(error));
|
|
@@ -6108,6 +6164,8 @@ function _define_property(obj, key, value) {
|
|
|
6108
6164
|
* ```
|
|
6109
6165
|
*
|
|
6110
6166
|
* @param config - work function and delegate configuration
|
|
6167
|
+
* @param config.work - the work function to execute for each input value
|
|
6168
|
+
* @param config.delegate - delegate that receives lifecycle callbacks (start, success, reject)
|
|
6111
6169
|
* @returns a factory function that creates WorkInstance for each input
|
|
6112
6170
|
*/ function workFactory(param) {
|
|
6113
6171
|
var work = param.work, delegate = param.delegate;
|
|
@@ -6121,13 +6179,11 @@ function _define_property(obj, key, value) {
|
|
|
6121
6179
|
handler.reject(e);
|
|
6122
6180
|
return;
|
|
6123
6181
|
}
|
|
6124
|
-
if (!handler.isComplete) {
|
|
6125
|
-
if (
|
|
6126
|
-
|
|
6127
|
-
throw new Error('Work already marked as begun from returned result. Either return an observable or use the handler directly.');
|
|
6128
|
-
}
|
|
6129
|
-
handler.startWorkingWithObservable(fnResult);
|
|
6182
|
+
if (!handler.isComplete && fnResult && rxjs.isObservable(fnResult)) {
|
|
6183
|
+
if (handler.hasStarted) {
|
|
6184
|
+
throw new Error('Work already marked as begun from returned result. Either return an observable or use the handler directly.');
|
|
6130
6185
|
}
|
|
6186
|
+
handler.startWorkingWithObservable(fnResult);
|
|
6131
6187
|
}
|
|
6132
6188
|
return handler;
|
|
6133
6189
|
};
|