@dereekb/rxjs 13.4.0 → 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 +231 -157
- package/index.esm.js +232 -158
- 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 +6 -0
- package/src/lib/loading/loading.state.rxjs.d.ts +2 -1
- package/src/lib/lock.d.ts +16 -4
- 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/set.d.ts +4 -0
- package/src/lib/rxjs/value.d.ts +40 -4
- 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) {
|
|
@@ -388,7 +419,7 @@ function _array_like_to_array$a(arr, len) {
|
|
|
388
419
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
389
420
|
return arr2;
|
|
390
421
|
}
|
|
391
|
-
function _array_without_holes$
|
|
422
|
+
function _array_without_holes$6(arr) {
|
|
392
423
|
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
393
424
|
}
|
|
394
425
|
function _class_call_check$8(instance, Constructor) {
|
|
@@ -422,14 +453,14 @@ function _define_property$c(obj, key, value) {
|
|
|
422
453
|
}
|
|
423
454
|
return obj;
|
|
424
455
|
}
|
|
425
|
-
function _iterable_to_array$
|
|
456
|
+
function _iterable_to_array$6(iter) {
|
|
426
457
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
427
458
|
}
|
|
428
|
-
function _non_iterable_spread$
|
|
459
|
+
function _non_iterable_spread$6() {
|
|
429
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.");
|
|
430
461
|
}
|
|
431
|
-
function _to_consumable_array$
|
|
432
|
-
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();
|
|
433
464
|
}
|
|
434
465
|
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
435
466
|
if (!o) return;
|
|
@@ -469,6 +500,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
469
500
|
key: "hasSubscription",
|
|
470
501
|
get: /**
|
|
471
502
|
* Whether a subscription is currently being managed.
|
|
503
|
+
*
|
|
504
|
+
* @returns true if a subscription is currently active
|
|
472
505
|
*/ function get() {
|
|
473
506
|
return Boolean(this._subscription);
|
|
474
507
|
}
|
|
@@ -548,6 +581,8 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
548
581
|
key: "hasSubscription",
|
|
549
582
|
get: /**
|
|
550
583
|
* Whether any subscriptions are currently being managed.
|
|
584
|
+
*
|
|
585
|
+
* @returns true if one or more subscriptions are currently active
|
|
551
586
|
*/ function get() {
|
|
552
587
|
var _this__subscriptions;
|
|
553
588
|
return Boolean((_this__subscriptions = this._subscriptions) === null || _this__subscriptions === void 0 ? void 0 : _this__subscriptions.length);
|
|
@@ -580,7 +615,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
|
|
|
580
615
|
*/ key: "addSubs",
|
|
581
616
|
value: function addSubs(subs) {
|
|
582
617
|
var _this__subscriptions;
|
|
583
|
-
var nextSubscriptions = _to_consumable_array$
|
|
618
|
+
var nextSubscriptions = _to_consumable_array$6((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
|
|
584
619
|
util.convertToArray(subs).forEach(function(sub) {
|
|
585
620
|
if (!nextSubscriptions.includes(sub)) {
|
|
586
621
|
nextSubscriptions.push(sub);
|
|
@@ -813,24 +848,23 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
813
848
|
key: "initFilterTakesPriority",
|
|
814
849
|
value: function initFilterTakesPriority() {
|
|
815
850
|
var _this = this;
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
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
|
+
});
|
|
834
868
|
}
|
|
835
869
|
},
|
|
836
870
|
{
|
|
@@ -855,7 +889,7 @@ function _array_like_to_array$8(arr, len) {
|
|
|
855
889
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
856
890
|
return arr2;
|
|
857
891
|
}
|
|
858
|
-
function _array_without_holes$
|
|
892
|
+
function _array_without_holes$5(arr) {
|
|
859
893
|
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
860
894
|
}
|
|
861
895
|
function _class_call_check$6(instance, Constructor) {
|
|
@@ -889,14 +923,14 @@ function _define_property$a(obj, key, value) {
|
|
|
889
923
|
}
|
|
890
924
|
return obj;
|
|
891
925
|
}
|
|
892
|
-
function _iterable_to_array$
|
|
926
|
+
function _iterable_to_array$5(iter) {
|
|
893
927
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
894
928
|
}
|
|
895
|
-
function _non_iterable_spread$
|
|
929
|
+
function _non_iterable_spread$5() {
|
|
896
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.");
|
|
897
931
|
}
|
|
898
|
-
function _to_consumable_array$
|
|
899
|
-
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();
|
|
900
934
|
}
|
|
901
935
|
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
902
936
|
if (!o) return;
|
|
@@ -1055,6 +1089,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1055
1089
|
{
|
|
1056
1090
|
/**
|
|
1057
1091
|
* Sets the default filter observable for this key.
|
|
1092
|
+
*
|
|
1093
|
+
* @param filterObs - the observable to use as the default filter for this key
|
|
1058
1094
|
*/ key: "initWithFilter",
|
|
1059
1095
|
value: function initWithFilter(filterObs) {
|
|
1060
1096
|
this.dbxFilterMap.addDefaultFilterObs(this.key, filterObs);
|
|
@@ -1063,6 +1099,8 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1063
1099
|
{
|
|
1064
1100
|
/**
|
|
1065
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
|
|
1066
1104
|
*/ key: "connectWithSource",
|
|
1067
1105
|
value: function connectWithSource(filterSource) {
|
|
1068
1106
|
this.dbxFilterMap.addFilterObs(this.key, filterSource.filter$);
|
|
@@ -1080,7 +1118,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1080
1118
|
_define_property$a(this, "_source", new FilterSourceInstance());
|
|
1081
1119
|
_define_property$a(this, "_obs", new rxjs.BehaviorSubject([]));
|
|
1082
1120
|
_define_property$a(this, "_obs$", this._obs.pipe(rxjs.switchMap(function(x) {
|
|
1083
|
-
return rxjs.merge.apply(void 0, _to_consumable_array$
|
|
1121
|
+
return rxjs.merge.apply(void 0, _to_consumable_array$5(x.map(function(y) {
|
|
1084
1122
|
return y.obs;
|
|
1085
1123
|
})));
|
|
1086
1124
|
}), rxjs.distinctUntilChanged()));
|
|
@@ -1121,7 +1159,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
|
|
|
1121
1159
|
var deleteOnComplete = obs.pipe(rxjs.finalize(function() {
|
|
1122
1160
|
_this._deleteFilterObs(i);
|
|
1123
1161
|
})).subscribe();
|
|
1124
|
-
var nextObs = _to_consumable_array$
|
|
1162
|
+
var nextObs = _to_consumable_array$5(currentObs).concat([
|
|
1125
1163
|
{
|
|
1126
1164
|
i: i,
|
|
1127
1165
|
obs: obs,
|
|
@@ -1528,17 +1566,17 @@ function _array_like_to_array$7(arr, len) {
|
|
|
1528
1566
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1529
1567
|
return arr2;
|
|
1530
1568
|
}
|
|
1531
|
-
function _array_without_holes$
|
|
1569
|
+
function _array_without_holes$4(arr) {
|
|
1532
1570
|
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
1533
1571
|
}
|
|
1534
|
-
function _iterable_to_array$
|
|
1572
|
+
function _iterable_to_array$4(iter) {
|
|
1535
1573
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1536
1574
|
}
|
|
1537
|
-
function _non_iterable_spread$
|
|
1575
|
+
function _non_iterable_spread$4() {
|
|
1538
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.");
|
|
1539
1577
|
}
|
|
1540
|
-
function _to_consumable_array$
|
|
1541
|
-
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();
|
|
1542
1580
|
}
|
|
1543
1581
|
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
1544
1582
|
if (!o) return;
|
|
@@ -1564,7 +1602,7 @@ function scanIntoArray() {
|
|
|
1564
1602
|
return rxjs.scan(function(acc, next) {
|
|
1565
1603
|
if (next != null) {
|
|
1566
1604
|
if (immutable) {
|
|
1567
|
-
acc = acc.concat(next);
|
|
1605
|
+
acc = _to_consumable_array$4(acc).concat(_to_consumable_array$4(util.asArray(next)));
|
|
1568
1606
|
} else {
|
|
1569
1607
|
acc = util.pushItemOrArrayItemsIntoArray(acc, next);
|
|
1570
1608
|
}
|
|
@@ -1594,7 +1632,7 @@ function scanIntoArray() {
|
|
|
1594
1632
|
}
|
|
1595
1633
|
return acc;
|
|
1596
1634
|
}, seed !== null && seed !== void 0 ? seed : []), distinctUntilArrayLengthChanges(), rxjs.map(function(x) {
|
|
1597
|
-
return _to_consumable_array$
|
|
1635
|
+
return _to_consumable_array$4(x);
|
|
1598
1636
|
}), rxjs.shareReplay(1));
|
|
1599
1637
|
});
|
|
1600
1638
|
}
|
|
@@ -1684,7 +1722,7 @@ function scanIntoArray() {
|
|
|
1684
1722
|
if (!acc.fromMatch || requireConsecutive) {
|
|
1685
1723
|
fromMatch = isMatch(from, next);
|
|
1686
1724
|
value = next;
|
|
1687
|
-
} else
|
|
1725
|
+
} else {
|
|
1688
1726
|
value = acc.value;
|
|
1689
1727
|
}
|
|
1690
1728
|
}
|
|
@@ -1718,6 +1756,8 @@ function scanIntoArray() {
|
|
|
1718
1756
|
}
|
|
1719
1757
|
/**
|
|
1720
1758
|
* RxJS operator that negates each emitted boolean value.
|
|
1759
|
+
*
|
|
1760
|
+
* @returns operator that maps each boolean emission to its negated value
|
|
1721
1761
|
*/ function isNot() {
|
|
1722
1762
|
return rxjs.map(function(x) {
|
|
1723
1763
|
return !x;
|
|
@@ -1725,6 +1765,8 @@ function scanIntoArray() {
|
|
|
1725
1765
|
}
|
|
1726
1766
|
/**
|
|
1727
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
|
|
1728
1770
|
*/ function onTrueToFalse() {
|
|
1729
1771
|
return onMatchDelta({
|
|
1730
1772
|
from: true,
|
|
@@ -1734,6 +1776,8 @@ function scanIntoArray() {
|
|
|
1734
1776
|
}
|
|
1735
1777
|
/**
|
|
1736
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
|
|
1737
1781
|
*/ function onFalseToTrue() {
|
|
1738
1782
|
return onMatchDelta({
|
|
1739
1783
|
from: false,
|
|
@@ -1752,6 +1796,7 @@ function scanIntoArray() {
|
|
|
1752
1796
|
* @returns the inverted (or original) decision function
|
|
1753
1797
|
*/ function invertObservableDecision(decisionFn) {
|
|
1754
1798
|
var invert = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1799
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1755
1800
|
if (invert) {
|
|
1756
1801
|
return function(value) {
|
|
1757
1802
|
var obs = decisionFn(value);
|
|
@@ -1806,7 +1851,7 @@ function scanIntoArray() {
|
|
|
1806
1851
|
* time relative to the current moment.
|
|
1807
1852
|
*
|
|
1808
1853
|
* @param expiresIn - duration in milliseconds until expiration
|
|
1809
|
-
* @returns an
|
|
1854
|
+
* @returns an `OperatorFunction` that maps each emission to an {@link Expires} object
|
|
1810
1855
|
*/ function toExpiration(expiresIn) {
|
|
1811
1856
|
return rxjs.map(function() {
|
|
1812
1857
|
var now = new Date();
|
|
@@ -1821,6 +1866,8 @@ function scanIntoArray() {
|
|
|
1821
1866
|
}
|
|
1822
1867
|
/**
|
|
1823
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
|
|
1824
1871
|
*/ function skipExpired() {
|
|
1825
1872
|
return rxjs.filter(function(expires) {
|
|
1826
1873
|
return !util.expirationDetails({
|
|
@@ -1832,6 +1879,7 @@ function scanIntoArray() {
|
|
|
1832
1879
|
* RxJS operator that skips emissions until the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1833
1880
|
*
|
|
1834
1881
|
* @param expiresIn - duration in milliseconds
|
|
1882
|
+
* @returns operator that skips emissions until the time window has elapsed
|
|
1835
1883
|
*/ function skipUntilExpiration(expiresIn) {
|
|
1836
1884
|
return rxjs.filter(function(x) {
|
|
1837
1885
|
return util.expirationDetails({
|
|
@@ -1844,6 +1892,7 @@ function scanIntoArray() {
|
|
|
1844
1892
|
* RxJS operator that skips emissions after the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
|
|
1845
1893
|
*
|
|
1846
1894
|
* @param expiresIn - duration in milliseconds
|
|
1895
|
+
* @returns operator that passes through emissions only within the time window
|
|
1847
1896
|
*/ function skipAfterExpiration(expiresIn) {
|
|
1848
1897
|
return rxjs.filter(function(x) {
|
|
1849
1898
|
return !util.expirationDetails({
|
|
@@ -1857,6 +1906,7 @@ function scanIntoArray() {
|
|
|
1857
1906
|
*
|
|
1858
1907
|
* @param watch - observable whose emissions reset the time window
|
|
1859
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
|
|
1860
1910
|
*/ function skipUntilTimeElapsedAfterLastEmission(watch, takeFor) {
|
|
1861
1911
|
return function(observable) {
|
|
1862
1912
|
return watch.pipe(rxjs.switchMap(function() {
|
|
@@ -1876,6 +1926,7 @@ function scanIntoArray() {
|
|
|
1876
1926
|
*
|
|
1877
1927
|
* @param watch - observable whose emissions reset the skip window
|
|
1878
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
|
|
1879
1930
|
*/ function takeAfterTimeElapsedSinceLastEmission(watch, skipFor) {
|
|
1880
1931
|
return function(observable) {
|
|
1881
1932
|
return watch.pipe(rxjs.switchMap(function() {
|
|
@@ -2027,7 +2078,7 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
|
|
|
2027
2078
|
return result;
|
|
2028
2079
|
}), rxjs.finalize(function() {
|
|
2029
2080
|
if (currentInstance) {
|
|
2030
|
-
destroy(currentInstance);
|
|
2081
|
+
void destroy(currentInstance);
|
|
2031
2082
|
}
|
|
2032
2083
|
}));
|
|
2033
2084
|
};
|
|
@@ -2103,6 +2154,8 @@ function tapLog(messageOrFunction) {
|
|
|
2103
2154
|
|
|
2104
2155
|
/**
|
|
2105
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`
|
|
2106
2159
|
*/ function distinctUntilModelIdChange() {
|
|
2107
2160
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2108
2161
|
return x.id;
|
|
@@ -2110,6 +2163,8 @@ function tapLog(messageOrFunction) {
|
|
|
2110
2163
|
}
|
|
2111
2164
|
/**
|
|
2112
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`
|
|
2113
2168
|
*/ function distinctUntilModelKeyChange() {
|
|
2114
2169
|
return distinctUntilObjectKeyChange(function(x) {
|
|
2115
2170
|
return x.key;
|
|
@@ -2425,6 +2480,12 @@ function _array_like_to_array$5(arr, len) {
|
|
|
2425
2480
|
function _array_with_holes$2(arr) {
|
|
2426
2481
|
if (Array.isArray(arr)) return arr;
|
|
2427
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
|
+
}
|
|
2428
2489
|
function _iterable_to_array_limit$2(arr, i) {
|
|
2429
2490
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2430
2491
|
if (_i == null) return;
|
|
@@ -2452,9 +2513,15 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
2452
2513
|
function _non_iterable_rest$2() {
|
|
2453
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.");
|
|
2454
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
|
+
}
|
|
2455
2519
|
function _sliced_to_array$2(arr, i) {
|
|
2456
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();
|
|
2457
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
|
+
}
|
|
2458
2525
|
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2459
2526
|
if (!o) return;
|
|
2460
2527
|
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
@@ -2472,7 +2539,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2472
2539
|
*/ function combineLatestFromMapValuesObsFn(mapToObs) {
|
|
2473
2540
|
var combineArrayFn = combineLatestFromArrayObsFn(mapToObs);
|
|
2474
2541
|
return function(latestMap) {
|
|
2475
|
-
var mapValues =
|
|
2542
|
+
var mapValues = _to_consumable_array$3(latestMap).map(function(y) {
|
|
2476
2543
|
return y[1];
|
|
2477
2544
|
});
|
|
2478
2545
|
return combineArrayFn(mapValues);
|
|
@@ -2522,7 +2589,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2522
2589
|
var result = {};
|
|
2523
2590
|
latestValues.forEach(function(param) {
|
|
2524
2591
|
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
2525
|
-
result[key] = value;
|
|
2592
|
+
result[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
2526
2593
|
});
|
|
2527
2594
|
return result;
|
|
2528
2595
|
}));
|
|
@@ -2565,7 +2632,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2565
2632
|
*/ function errorOnEmissionsInPeriod(config) {
|
|
2566
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;
|
|
2567
2634
|
var errorMessage = inputErrorMessage !== null && inputErrorMessage !== void 0 ? inputErrorMessage : 'errorOnEmissionsInPeriod(): Too many emissions in time period.';
|
|
2568
|
-
var errorFactory = inputErrorFactory ? inputErrorFactory : !switchToObs ? function() {
|
|
2635
|
+
var errorFactory = inputErrorFactory !== null && inputErrorFactory !== void 0 ? inputErrorFactory : !switchToObs ? function() {
|
|
2569
2636
|
return new Error(errorMessage);
|
|
2570
2637
|
} : undefined;
|
|
2571
2638
|
return function(source) {
|
|
@@ -2625,6 +2692,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
2625
2692
|
}
|
|
2626
2693
|
/**
|
|
2627
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
|
|
2628
2697
|
*/ function distinctUntilHasDifferentValues() {
|
|
2629
2698
|
return rxjs.distinctUntilChanged(util.hasSameValues);
|
|
2630
2699
|
}
|
|
@@ -2878,7 +2947,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2878
2947
|
if (loading === true) {
|
|
2879
2948
|
result = false;
|
|
2880
2949
|
} else {
|
|
2881
|
-
|
|
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;
|
|
2882
2952
|
}
|
|
2883
2953
|
}
|
|
2884
2954
|
return result;
|
|
@@ -2894,6 +2964,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
2894
2964
|
* // { loading: false }
|
|
2895
2965
|
* loadingStateType(state); // LoadingStateType.IDLE
|
|
2896
2966
|
* ```
|
|
2967
|
+
*
|
|
2968
|
+
* @returns a loading state with `loading: false` and no value or error
|
|
2897
2969
|
*/ function idleLoadingState() {
|
|
2898
2970
|
return {
|
|
2899
2971
|
loading: false
|
|
@@ -3018,8 +3090,7 @@ function beginLoading(state) {
|
|
|
3018
3090
|
*/ function isLoadingStateWithStateType(type) {
|
|
3019
3091
|
var defaultResult = type === exports.LoadingStateType.IDLE ? true : false;
|
|
3020
3092
|
return function(state) {
|
|
3021
|
-
|
|
3022
|
-
return result;
|
|
3093
|
+
return state ? loadingStateType(state) === type : defaultResult;
|
|
3023
3094
|
};
|
|
3024
3095
|
}
|
|
3025
3096
|
/**
|
|
@@ -3062,8 +3133,7 @@ function beginLoading(state) {
|
|
|
3062
3133
|
* @param state - the loading state to check
|
|
3063
3134
|
* @returns true if the state has a defined (non-undefined) value
|
|
3064
3135
|
*/ function isLoadingStateWithDefinedValue(state) {
|
|
3065
|
-
|
|
3066
|
-
return result;
|
|
3136
|
+
return state ? state.value !== undefined : false;
|
|
3067
3137
|
}
|
|
3068
3138
|
/**
|
|
3069
3139
|
* Type guard that checks whether a {@link LoadingState} has a non-null error, regardless of loading status.
|
|
@@ -3077,8 +3147,7 @@ function beginLoading(state) {
|
|
|
3077
3147
|
* @param state - the loading state to check
|
|
3078
3148
|
* @returns true if the state has an error
|
|
3079
3149
|
*/ function isLoadingStateWithError(state) {
|
|
3080
|
-
|
|
3081
|
-
return result;
|
|
3150
|
+
return state ? state.error != null : false;
|
|
3082
3151
|
}
|
|
3083
3152
|
/**
|
|
3084
3153
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has a defined value.
|
|
@@ -3086,8 +3155,7 @@ function beginLoading(state) {
|
|
|
3086
3155
|
* @param state - the loading state to check
|
|
3087
3156
|
* @returns true if finished loading with a non-undefined value
|
|
3088
3157
|
*/ function isLoadingStateFinishedLoadingWithDefinedValue(state) {
|
|
3089
|
-
|
|
3090
|
-
return result;
|
|
3158
|
+
return state ? isLoadingStateFinishedLoading(state) && state.value !== undefined : false;
|
|
3091
3159
|
}
|
|
3092
3160
|
/**
|
|
3093
3161
|
* Type guard that checks whether a {@link LoadingState} has finished loading and has an error.
|
|
@@ -3095,8 +3163,7 @@ function beginLoading(state) {
|
|
|
3095
3163
|
* @param state - the loading state to check
|
|
3096
3164
|
* @returns true if finished loading with an error
|
|
3097
3165
|
*/ function isLoadingStateFinishedLoadingWithError(state) {
|
|
3098
|
-
|
|
3099
|
-
return result;
|
|
3166
|
+
return state ? isLoadingStateFinishedLoading(state) && state.error != null : false;
|
|
3100
3167
|
}
|
|
3101
3168
|
/**
|
|
3102
3169
|
* Compares the metadata (page, loading, error) of two {@link PageLoadingState} instances for equivalence.
|
|
@@ -3127,15 +3194,16 @@ function mergeLoadingStates() {
|
|
|
3127
3194
|
args[_key] = arguments[_key];
|
|
3128
3195
|
}
|
|
3129
3196
|
var _loadingStates_find;
|
|
3130
|
-
|
|
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
|
|
3131
3199
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3132
|
-
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
|
|
3133
3201
|
var mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : function() {
|
|
3134
3202
|
for(var _len = arguments.length, inputArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3135
3203
|
inputArgs[_key] = arguments[_key];
|
|
3136
3204
|
}
|
|
3137
3205
|
return util.mergeObjects(inputArgs);
|
|
3138
|
-
};
|
|
3206
|
+
}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3139
3207
|
var error = (_loadingStates_find = loadingStates.find(function(x) {
|
|
3140
3208
|
return x.error;
|
|
3141
3209
|
})) === null || _loadingStates_find === void 0 ? void 0 : _loadingStates_find.error; // find the first error
|
|
@@ -3143,7 +3211,7 @@ function mergeLoadingStates() {
|
|
|
3143
3211
|
if (error) {
|
|
3144
3212
|
// ignore all loading states, except for any error-prone item that is still loading
|
|
3145
3213
|
var currentLoadings = loadingStates.map(function(x) {
|
|
3146
|
-
return
|
|
3214
|
+
return x.error ? x.loading : false;
|
|
3147
3215
|
});
|
|
3148
3216
|
var nonMaybeLoadings = currentLoadings.filter(function(x) {
|
|
3149
3217
|
return x != null;
|
|
@@ -3229,10 +3297,10 @@ function mergeLoadingStates() {
|
|
|
3229
3297
|
var mapValues = config.mapValues, mapState = config.mapState;
|
|
3230
3298
|
var loading = isAnyLoadingStateInLoadingState(input);
|
|
3231
3299
|
var error = input.map(function(x) {
|
|
3232
|
-
return x
|
|
3233
|
-
}).
|
|
3300
|
+
return x.error;
|
|
3301
|
+
}).find(function(x) {
|
|
3234
3302
|
return Boolean(x);
|
|
3235
|
-
})
|
|
3303
|
+
});
|
|
3236
3304
|
var result;
|
|
3237
3305
|
if (!error && !loading) {
|
|
3238
3306
|
if (mapValues) {
|
|
@@ -3254,7 +3322,7 @@ function mergeLoadingStates() {
|
|
|
3254
3322
|
}
|
|
3255
3323
|
function mapLoadingStateResults(input, config) {
|
|
3256
3324
|
var mapValue = config.mapValue, mapState = config.mapState, _config_alwaysMapValue = config.alwaysMapValue, alwaysMapValue = _config_alwaysMapValue === void 0 ? false : _config_alwaysMapValue;
|
|
3257
|
-
var inputValue = input
|
|
3325
|
+
var inputValue = input.value;
|
|
3258
3326
|
var value;
|
|
3259
3327
|
if ((inputValue != null || alwaysMapValue) && mapValue) {
|
|
3260
3328
|
value = mapValue(inputValue, input);
|
|
@@ -3394,24 +3462,20 @@ function combineLoadingStates() {
|
|
|
3394
3462
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3395
3463
|
args[_key] = arguments[_key];
|
|
3396
3464
|
}
|
|
3397
|
-
|
|
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
|
|
3398
3467
|
var lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
3399
|
-
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
|
|
3400
3469
|
var mergeFn = lastValueIsMergeFn ? validArgs[validArgs.length - 1] : undefined;
|
|
3401
3470
|
return rxjs.combineLatest(obsArgs).pipe(rxjs.distinctUntilChanged(function(x, y) {
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
}) === -1;
|
|
3406
|
-
return hasSameValues;
|
|
3407
|
-
} else {
|
|
3408
|
-
return x === y;
|
|
3409
|
-
}
|
|
3471
|
+
return !x.some(function(_, i) {
|
|
3472
|
+
return x[i] !== y[i];
|
|
3473
|
+
});
|
|
3410
3474
|
}), rxjs.map(function(states) {
|
|
3411
|
-
|
|
3475
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3476
|
+
return mergeLoadingStates.apply(void 0, _to_consumable_array$1(states).concat([
|
|
3412
3477
|
mergeFn
|
|
3413
3478
|
]));
|
|
3414
|
-
return result;
|
|
3415
3479
|
}), rxjs.shareReplay(1) // Share the result.
|
|
3416
3480
|
);
|
|
3417
3481
|
}
|
|
@@ -3438,6 +3502,7 @@ function combineLoadingStates() {
|
|
|
3438
3502
|
* @param sources - An array of LoadingState observables to combine.
|
|
3439
3503
|
* @returns An observable emitting a {@link LoadingState}<boolean> representing the combined status.
|
|
3440
3504
|
*/ function combineLoadingStatesStatus(sources) {
|
|
3505
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3441
3506
|
return rxjs.combineLatest(sources).pipe(rxjs.map(function(allLoadingStates) {
|
|
3442
3507
|
var firstErrorState = allLoadingStates.find(function(x) {
|
|
3443
3508
|
return x.error;
|
|
@@ -3446,7 +3511,7 @@ function combineLoadingStates() {
|
|
|
3446
3511
|
if (firstErrorState) {
|
|
3447
3512
|
result = errorResult(firstErrorState.error);
|
|
3448
3513
|
} else {
|
|
3449
|
-
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.
|
|
3514
|
+
var oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.some(isLoadingStateLoading);
|
|
3450
3515
|
if (oneOrMoreStatesAreCurrentlyLoading) {
|
|
3451
3516
|
result = beginLoading(); // still loading
|
|
3452
3517
|
} else {
|
|
@@ -3574,7 +3639,7 @@ function tapOnLoadingStateType(fn, type) {
|
|
|
3574
3639
|
};
|
|
3575
3640
|
}
|
|
3576
3641
|
return rxjs.tap(function(state) {
|
|
3577
|
-
if (
|
|
3642
|
+
if (decisionFunction(state)) {
|
|
3578
3643
|
fn(state);
|
|
3579
3644
|
}
|
|
3580
3645
|
});
|
|
@@ -3726,6 +3791,10 @@ function distinctLoadingState(inputConfig) {
|
|
|
3726
3791
|
*
|
|
3727
3792
|
* Determines the `loading` flag based on whether an error is present, whether the value is defined,
|
|
3728
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
|
|
3729
3798
|
*/ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION(state, input) {
|
|
3730
3799
|
var showLoadingOnUndefinedValue = input.showLoadingOnUndefinedValue;
|
|
3731
3800
|
var error = state.error, value = state.value, loadingProgress = state.loadingProgress;
|
|
@@ -3796,7 +3865,7 @@ function distinctLoadingState(inputConfig) {
|
|
|
3796
3865
|
return result;
|
|
3797
3866
|
}), rxjs.distinctUntilChanged(isLoadingStateEqual), rxjs.shareReplay(1));
|
|
3798
3867
|
var currentState$ = currentStateStream$.pipe(rxjs.switchMap(function(x) {
|
|
3799
|
-
return x ? x : rxjs.of(undefined);
|
|
3868
|
+
return x !== null && x !== void 0 ? x : rxjs.of(undefined);
|
|
3800
3869
|
}));
|
|
3801
3870
|
var state$ = currentState$.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
3802
3871
|
var loading$ = eventStream$.pipe(rxjs.map(isLoadingStateLoading));
|
|
@@ -3840,7 +3909,8 @@ function distinctLoadingState(inputConfig) {
|
|
|
3840
3909
|
* @param listLoadingState - the list loading state to check
|
|
3841
3910
|
* @returns true if the value is empty or absent
|
|
3842
3911
|
*/ function isListLoadingStateWithEmptyValue(listLoadingState) {
|
|
3843
|
-
|
|
3912
|
+
var _listLoadingState_value;
|
|
3913
|
+
return Boolean(!((_listLoadingState_value = listLoadingState.value) === null || _listLoadingState_value === void 0 ? void 0 : _listLoadingState_value.length));
|
|
3844
3914
|
}
|
|
3845
3915
|
/**
|
|
3846
3916
|
* RxJS operator that maps each emitted {@link ListLoadingState} to a boolean indicating whether the list is empty.
|
|
@@ -4122,6 +4192,8 @@ function _object_spread_props$3(target, source) {
|
|
|
4122
4192
|
{
|
|
4123
4193
|
/**
|
|
4124
4194
|
* Whether the current state has a non-null error.
|
|
4195
|
+
*
|
|
4196
|
+
* @returns true if the current state contains an error
|
|
4125
4197
|
*/ key: "hasError",
|
|
4126
4198
|
value: function hasError() {
|
|
4127
4199
|
return isLoadingStateWithError(this._subject.value);
|
|
@@ -4614,55 +4686,48 @@ function itemAccumulator(itemIteration, inputMapItem) {
|
|
|
4614
4686
|
return rxjs.from(util.asPromise(countResults(allItems)));
|
|
4615
4687
|
})).subscribe({
|
|
4616
4688
|
next: function next(currentResultsCount) {
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
result = _state.sent();
|
|
4633
|
-
currentResultsCount = result.currentCount;
|
|
4634
|
-
return [
|
|
4635
|
-
2,
|
|
4636
|
-
result.shouldContinue
|
|
4637
|
-
];
|
|
4638
|
-
}
|
|
4639
|
-
});
|
|
4640
|
-
})();
|
|
4641
|
-
},
|
|
4642
|
-
next: function next() {
|
|
4643
|
-
return _async_to_generator(function() {
|
|
4644
|
-
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;
|
|
4645
4704
|
return [
|
|
4646
4705
|
2,
|
|
4647
|
-
|
|
4706
|
+
result.shouldContinue
|
|
4648
4707
|
];
|
|
4649
|
-
|
|
4650
|
-
})();
|
|
4651
|
-
}
|
|
4652
|
-
}).then(function(page) {
|
|
4653
|
-
resolve({
|
|
4654
|
-
page: page,
|
|
4655
|
-
resultsCount: currentResultsCount
|
|
4708
|
+
}
|
|
4656
4709
|
});
|
|
4657
|
-
})
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
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
|
|
4664
4726
|
});
|
|
4665
|
-
})()
|
|
4727
|
+
}).catch(function(error) {
|
|
4728
|
+
reject(error);
|
|
4729
|
+
throw error;
|
|
4730
|
+
});
|
|
4666
4731
|
},
|
|
4667
4732
|
error: function error(error) {
|
|
4668
4733
|
reject(error);
|
|
@@ -4729,7 +4794,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4729
4794
|
return accumulator.currentAllItemPairs$.pipe(scanBuildArray(function(allItems) {
|
|
4730
4795
|
var pairs = allItems;
|
|
4731
4796
|
var firstLatestItemPair = util.lastValue(allItems);
|
|
4732
|
-
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
|
|
4733
4798
|
var seed = util.flattenArray(pairs.map(function(x) {
|
|
4734
4799
|
return x.output;
|
|
4735
4800
|
}));
|
|
@@ -4796,6 +4861,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
4796
4861
|
* @param pageItemAccumulator - accumulator to observe the current page from
|
|
4797
4862
|
* @returns observable emitting the most recently loaded page number
|
|
4798
4863
|
*/ function pageItemAccumulatorCurrentPage(pageItemAccumulator) {
|
|
4864
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4799
4865
|
return pageItemAccumulator.itemIteration.latestLoadedPage$;
|
|
4800
4866
|
}
|
|
4801
4867
|
|
|
@@ -5161,11 +5227,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5161
5227
|
hasNextPage: util.invertMaybeBoolean(end)
|
|
5162
5228
|
});
|
|
5163
5229
|
}
|
|
5164
|
-
|
|
5230
|
+
return {
|
|
5165
5231
|
n: request.n,
|
|
5166
5232
|
state: state
|
|
5167
5233
|
};
|
|
5168
|
-
return result;
|
|
5169
5234
|
}));
|
|
5170
5235
|
}), rxjs.scan(function(acc, x) {
|
|
5171
5236
|
var n = x.n, curr = x.state;
|
|
@@ -5178,19 +5243,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5178
5243
|
lastSuccessful: acc.lastSuccessful
|
|
5179
5244
|
};
|
|
5180
5245
|
// If it was a replay of the previous result, change nothing.
|
|
5181
|
-
if (acc.current !== curr) {
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
if (!next.firstSuccessful) {
|
|
5191
|
-
next.firstSuccessful = curr;
|
|
5192
|
-
}
|
|
5193
|
-
}
|
|
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;
|
|
5194
5255
|
}
|
|
5195
5256
|
}
|
|
5196
5257
|
return next;
|
|
@@ -5499,6 +5560,10 @@ function _type_of(obj) {
|
|
|
5499
5560
|
* Useful for deferring an action until all locks are released, with a safety timeout to avoid waiting indefinitely.
|
|
5500
5561
|
*
|
|
5501
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
|
|
5502
5567
|
* @returns subscription that can be unsubscribed to cancel the wait
|
|
5503
5568
|
*
|
|
5504
5569
|
* @example
|
|
@@ -5926,14 +5991,14 @@ function _define_property(obj, key, value) {
|
|
|
5926
5991
|
*
|
|
5927
5992
|
* If the loading state returns an error, the error is forwarded.
|
|
5928
5993
|
*
|
|
5929
|
-
* @param loadingStateObs
|
|
5994
|
+
* @param loadingStateObs - observable of the loading state to track as the work result
|
|
5930
5995
|
*/ key: "startWorkingWithLoadingStateObservable",
|
|
5931
5996
|
value: function startWorkingWithLoadingStateObservable(loadingStateObs) {
|
|
5932
5997
|
var _this = this;
|
|
5933
5998
|
var obs = preventComplete(loadingStateObs).pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
5934
5999
|
this._sub.subscription = obs.pipe(rxjs.delay(0), rxjs.first()).subscribe(function() {
|
|
5935
6000
|
_this.startWorkingWithObservable(obs.pipe(rxjs.filter(function(x) {
|
|
5936
|
-
return
|
|
6001
|
+
return !isLoadingStateLoading(x);
|
|
5937
6002
|
}), rxjs.map(function(x) {
|
|
5938
6003
|
if (x.error) {
|
|
5939
6004
|
throw x.error;
|
|
@@ -5952,11 +6017,12 @@ function _define_property(obj, key, value) {
|
|
|
5952
6017
|
*
|
|
5953
6018
|
* It is used in conjunction with startWorking() and ideal for cases where multiple observables or promises are used.
|
|
5954
6019
|
*
|
|
5955
|
-
* @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
|
|
5956
6022
|
*/ key: "performTaskWithLoadingState",
|
|
5957
6023
|
value: function performTaskWithLoadingState(loadingStateObs) {
|
|
5958
6024
|
var _this = this;
|
|
5959
|
-
return promiseFromLoadingState(rxjs.from(loadingStateObs).pipe(filterMaybe(), rxjs.tap(function(
|
|
6025
|
+
return promiseFromLoadingState(rxjs.from(loadingStateObs).pipe(filterMaybe(), rxjs.tap(function(_x) {
|
|
5960
6026
|
_this._setWorking(true); // mark as working if not already marked.
|
|
5961
6027
|
}))).catch(function(e) {
|
|
5962
6028
|
// catch and throw any errors.
|
|
@@ -5971,7 +6037,7 @@ function _define_property(obj, key, value) {
|
|
|
5971
6037
|
*
|
|
5972
6038
|
* If an error is thrown, the error is forwarded to the reject function.
|
|
5973
6039
|
*
|
|
5974
|
-
* @param fn
|
|
6040
|
+
* @param fn - synchronous function that returns the result value or throws an error
|
|
5975
6041
|
*/ key: "performTaskWithReturnValue",
|
|
5976
6042
|
value: function performTaskWithReturnValue(fn) {
|
|
5977
6043
|
try {
|
|
@@ -5986,6 +6052,8 @@ function _define_property(obj, key, value) {
|
|
|
5986
6052
|
{
|
|
5987
6053
|
/**
|
|
5988
6054
|
* Begins working using a promise.
|
|
6055
|
+
*
|
|
6056
|
+
* @param promise - the promise that represents the asynchronous work
|
|
5989
6057
|
*/ key: "startWorkingWithPromise",
|
|
5990
6058
|
value: function startWorkingWithPromise(promise) {
|
|
5991
6059
|
this.startWorkingWithObservable(rxjs.from(promise));
|
|
@@ -5994,6 +6062,8 @@ function _define_property(obj, key, value) {
|
|
|
5994
6062
|
{
|
|
5995
6063
|
/**
|
|
5996
6064
|
* Begins working using an observable.
|
|
6065
|
+
*
|
|
6066
|
+
* @param workObs - the observable that represents the asynchronous work and emits the result
|
|
5997
6067
|
*/ key: "startWorkingWithObservable",
|
|
5998
6068
|
value: function startWorkingWithObservable(workObs) {
|
|
5999
6069
|
var _this = this;
|
|
@@ -6020,6 +6090,8 @@ function _define_property(obj, key, value) {
|
|
|
6020
6090
|
{
|
|
6021
6091
|
/**
|
|
6022
6092
|
* Sets success on the work.
|
|
6093
|
+
*
|
|
6094
|
+
* @param result - the successful result value to pass to the delegate
|
|
6023
6095
|
*/ key: "success",
|
|
6024
6096
|
value: function success(result) {
|
|
6025
6097
|
this._setComplete(successResult(result));
|
|
@@ -6029,6 +6101,8 @@ function _define_property(obj, key, value) {
|
|
|
6029
6101
|
{
|
|
6030
6102
|
/**
|
|
6031
6103
|
* Sets rejected on the work.
|
|
6104
|
+
*
|
|
6105
|
+
* @param error - the error to pass to the delegate as the rejection reason
|
|
6032
6106
|
*/ key: "reject",
|
|
6033
6107
|
value: function reject(error) {
|
|
6034
6108
|
this._setComplete(errorResult(error));
|
|
@@ -6090,6 +6164,8 @@ function _define_property(obj, key, value) {
|
|
|
6090
6164
|
* ```
|
|
6091
6165
|
*
|
|
6092
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)
|
|
6093
6169
|
* @returns a factory function that creates WorkInstance for each input
|
|
6094
6170
|
*/ function workFactory(param) {
|
|
6095
6171
|
var work = param.work, delegate = param.delegate;
|
|
@@ -6103,13 +6179,11 @@ function _define_property(obj, key, value) {
|
|
|
6103
6179
|
handler.reject(e);
|
|
6104
6180
|
return;
|
|
6105
6181
|
}
|
|
6106
|
-
if (!handler.isComplete) {
|
|
6107
|
-
if (
|
|
6108
|
-
|
|
6109
|
-
throw new Error('Work already marked as begun from returned result. Either return an observable or use the handler directly.');
|
|
6110
|
-
}
|
|
6111
|
-
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.');
|
|
6112
6185
|
}
|
|
6186
|
+
handler.startWorkingWithObservable(fnResult);
|
|
6113
6187
|
}
|
|
6114
6188
|
return handler;
|
|
6115
6189
|
};
|