@dereekb/rxjs 10.2.0 → 11.0.0
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 +505 -320
- package/index.esm.js +321 -183
- package/package.json +1 -1
- package/src/lib/iterator/iteration.accumulator.d.ts +2 -14
- package/src/lib/iterator/iteration.mapped.d.ts +1 -1
- package/src/lib/loading/loading.context.simple.d.ts +2 -2
- package/src/lib/loading/loading.context.state.d.ts +2 -1
- package/src/lib/loading/loading.state.d.ts +136 -31
- package/src/lib/loading/loading.state.list.d.ts +15 -2
- package/src/lib/loading/loading.state.rxjs.d.ts +1 -1
- package/src/lib/subscription.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -1751,6 +1751,7 @@ function filterIfObjectValuesUnchanged(input) {
|
|
|
1751
1751
|
*/
|
|
1752
1752
|
class SubscriptionObject {
|
|
1753
1753
|
constructor(sub) {
|
|
1754
|
+
this._subscription = void 0;
|
|
1754
1755
|
if (sub) {
|
|
1755
1756
|
this.setSub(sub);
|
|
1756
1757
|
}
|
|
@@ -1782,13 +1783,14 @@ class SubscriptionObject {
|
|
|
1782
1783
|
*/
|
|
1783
1784
|
class MultiSubscriptionObject {
|
|
1784
1785
|
constructor(subs) {
|
|
1786
|
+
this._subscriptions = void 0;
|
|
1785
1787
|
if (subs) {
|
|
1786
1788
|
this.setSubs(subs);
|
|
1787
1789
|
}
|
|
1788
1790
|
}
|
|
1789
1791
|
get hasSubscription() {
|
|
1790
|
-
var
|
|
1791
|
-
return Boolean((
|
|
1792
|
+
var _this$_subscriptions;
|
|
1793
|
+
return Boolean((_this$_subscriptions = this._subscriptions) == null ? void 0 : _this$_subscriptions.length);
|
|
1792
1794
|
}
|
|
1793
1795
|
set subscriptions(subs) {
|
|
1794
1796
|
this.setSubs(subs);
|
|
@@ -1819,7 +1821,7 @@ class FilterSourceInstance {
|
|
|
1819
1821
|
this._initialFilter = new rxjs.BehaviorSubject(undefined);
|
|
1820
1822
|
this._defaultFilter = new rxjs.BehaviorSubject(undefined);
|
|
1821
1823
|
this.defaultFilter$ = this._defaultFilter.pipe(switchMapMaybeObs());
|
|
1822
|
-
this.initialFilter$ = rxjs.combineLatest([this._initialFilter, this._defaultFilter]).pipe(rxjs.map(([a, b]) => a
|
|
1824
|
+
this.initialFilter$ = rxjs.combineLatest([this._initialFilter, this._defaultFilter]).pipe(rxjs.map(([a, b]) => a != null ? a : b), switchMapMaybeObs(), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
1823
1825
|
/**
|
|
1824
1826
|
* filter$ uses the latest value from any filter.
|
|
1825
1827
|
*/
|
|
@@ -1916,6 +1918,9 @@ class FilterMap {
|
|
|
1916
1918
|
}
|
|
1917
1919
|
class FilterMapKeyInstance {
|
|
1918
1920
|
constructor(dbxFilterMap, key) {
|
|
1921
|
+
this.dbxFilterMap = void 0;
|
|
1922
|
+
this.key = void 0;
|
|
1923
|
+
this.filter$ = void 0;
|
|
1919
1924
|
this.dbxFilterMap = dbxFilterMap;
|
|
1920
1925
|
this.key = key;
|
|
1921
1926
|
this.filter$ = this.dbxFilterMap.filterForKey(this.key);
|
|
@@ -1929,13 +1934,15 @@ class FilterMapKeyInstance {
|
|
|
1929
1934
|
}
|
|
1930
1935
|
class FilterMapItem {
|
|
1931
1936
|
constructor(dbxFilterMap, key) {
|
|
1932
|
-
this.dbxFilterMap =
|
|
1933
|
-
this.key =
|
|
1937
|
+
this.dbxFilterMap = void 0;
|
|
1938
|
+
this.key = void 0;
|
|
1934
1939
|
this._i = 0;
|
|
1935
1940
|
this._source = new FilterSourceInstance();
|
|
1936
1941
|
this._obs = new rxjs.BehaviorSubject([]);
|
|
1937
1942
|
this.obs$ = this._obs.pipe(rxjs.switchMap(x => rxjs.merge(...x.map(y => y.obs))), rxjs.distinctUntilChanged());
|
|
1938
1943
|
this.filter$ = this._source.initialFilter$;
|
|
1944
|
+
this.dbxFilterMap = dbxFilterMap;
|
|
1945
|
+
this.key = key;
|
|
1939
1946
|
}
|
|
1940
1947
|
setDefaultFilterObs(obs) {
|
|
1941
1948
|
this._source.setDefaultFilter(obs);
|
|
@@ -3153,42 +3160,35 @@ $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
3153
3160
|
}
|
|
3154
3161
|
});
|
|
3155
3162
|
|
|
3156
|
-
/******************************************************************************
|
|
3157
|
-
Copyright (c) Microsoft Corporation.
|
|
3158
|
-
|
|
3159
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3160
|
-
purpose with or without fee is hereby granted.
|
|
3161
|
-
|
|
3162
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3163
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3164
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3165
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3166
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3167
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3168
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3169
|
-
***************************************************************************** */
|
|
3170
|
-
|
|
3171
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
3172
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3173
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3174
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3175
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3176
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3177
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3178
|
-
});
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3182
|
-
var e = new Error(message);
|
|
3183
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3184
|
-
};
|
|
3185
|
-
|
|
3186
3163
|
/**
|
|
3187
3164
|
* Creates an observable from the input iteration that checks both the hasNext$ and canLoadMore$ states.
|
|
3188
3165
|
*
|
|
3189
3166
|
* @param iteration
|
|
3190
3167
|
* @returns
|
|
3191
3168
|
*/
|
|
3169
|
+
|
|
3170
|
+
function _async$2(f) {
|
|
3171
|
+
return function () {
|
|
3172
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
3173
|
+
args[i] = arguments[i];
|
|
3174
|
+
}
|
|
3175
|
+
try {
|
|
3176
|
+
return Promise.resolve(f.apply(this, args));
|
|
3177
|
+
} catch (e) {
|
|
3178
|
+
return Promise.reject(e);
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
} /**
|
|
3182
|
+
* Automatically calls next up to the current maxPageLoadLimit configured on the iterator.
|
|
3183
|
+
*
|
|
3184
|
+
* If no maximum limit is defined, uses the defaultLimit. If default limit is not defined or null, this will result in an error.
|
|
3185
|
+
*
|
|
3186
|
+
* The promise will reject with an error if an error is encountered.
|
|
3187
|
+
*
|
|
3188
|
+
* @param iterator
|
|
3189
|
+
* @param defaultLimit
|
|
3190
|
+
* @returns
|
|
3191
|
+
*/
|
|
3192
3192
|
function iterationHasNextAndCanLoadMore(iteration) {
|
|
3193
3193
|
return iteration.canLoadMore$.pipe(rxjs.switchMap(canLoadMore => {
|
|
3194
3194
|
if (canLoadMore) {
|
|
@@ -3198,21 +3198,10 @@ function iterationHasNextAndCanLoadMore(iteration) {
|
|
|
3198
3198
|
}
|
|
3199
3199
|
}), rxjs.shareReplay(1));
|
|
3200
3200
|
}
|
|
3201
|
-
/**
|
|
3202
|
-
* Automatically calls next up to the current maxPageLoadLimit configured on the iterator.
|
|
3203
|
-
*
|
|
3204
|
-
* If no maximum limit is defined, uses the defaultLimit. If default limit is not defined or null, this will result in an error.
|
|
3205
|
-
*
|
|
3206
|
-
* The promise will reject with an error if an error is encountered.
|
|
3207
|
-
*
|
|
3208
|
-
* @param iterator
|
|
3209
|
-
* @param defaultLimit
|
|
3210
|
-
* @returns
|
|
3211
|
-
*/
|
|
3212
3201
|
function iteratorNextPageUntilMaxPageLoadLimit(iterator, defaultLimit = 100) {
|
|
3213
3202
|
return iteratorNextPageUntilPage(iterator, () => {
|
|
3214
|
-
var
|
|
3215
|
-
const limit = (
|
|
3203
|
+
var _iterator$maxPageLoad;
|
|
3204
|
+
const limit = (_iterator$maxPageLoad = iterator.maxPageLoadLimit) != null ? _iterator$maxPageLoad : defaultLimit;
|
|
3216
3205
|
if (util.isMaybeNot(limit)) {
|
|
3217
3206
|
throw new Error('iteratorNextPageUntilMaxPageLoadLimit() failed. There was no maximum defined.');
|
|
3218
3207
|
}
|
|
@@ -3231,9 +3220,9 @@ function iteratorNextPageUntilMaxPageLoadLimit(iterator, defaultLimit = 100) {
|
|
|
3231
3220
|
function iteratorNextPageUntilPage(iteration, page) {
|
|
3232
3221
|
const getPageLimit = util.asGetter(page);
|
|
3233
3222
|
function checkPageLimit(page) {
|
|
3234
|
-
var
|
|
3223
|
+
var _iteration$maxPageLoa;
|
|
3235
3224
|
const pageLimit = getPageLimit();
|
|
3236
|
-
const maxLimit = Math.min(pageLimit, (
|
|
3225
|
+
const maxLimit = Math.min(pageLimit, (_iteration$maxPageLoa = iteration.maxPageLoadLimit) != null ? _iteration$maxPageLoa : Number.MAX_SAFE_INTEGER);
|
|
3237
3226
|
return page + 1 < maxLimit;
|
|
3238
3227
|
}
|
|
3239
3228
|
return new Promise((resolve, reject) => {
|
|
@@ -3241,11 +3230,11 @@ function iteratorNextPageUntilPage(iteration, page) {
|
|
|
3241
3230
|
next: firstLatestPage => {
|
|
3242
3231
|
const promise = util.performTaskLoop({
|
|
3243
3232
|
initValue: firstLatestPage,
|
|
3244
|
-
checkContinue:
|
|
3233
|
+
checkContinue: _async$2(function (latestPage) {
|
|
3245
3234
|
return rxjs.firstValueFrom(iterationHasNextAndCanLoadMore(iteration)).then(canLoadMore => canLoadMore && checkPageLimit(latestPage));
|
|
3246
3235
|
}),
|
|
3247
|
-
next: (
|
|
3248
|
-
return
|
|
3236
|
+
next: _async$2(function () {
|
|
3237
|
+
return iteration.nextPage();
|
|
3249
3238
|
})
|
|
3250
3239
|
});
|
|
3251
3240
|
resolve(promise);
|
|
@@ -3258,7 +3247,7 @@ function iteratorNextPageUntilPage(iteration, page) {
|
|
|
3258
3247
|
}
|
|
3259
3248
|
|
|
3260
3249
|
function distinctUntilArrayLengthChanges(inputGetArray) {
|
|
3261
|
-
const getArray = inputGetArray
|
|
3250
|
+
const getArray = inputGetArray != null ? inputGetArray : value => util.asArray(value);
|
|
3262
3251
|
return rxjs.distinctUntilChanged((a, b) => a === b, x => getArray(x).length);
|
|
3263
3252
|
}
|
|
3264
3253
|
function scanIntoArray(config = {}) {
|
|
@@ -3305,7 +3294,7 @@ function scanBuildArray(init) {
|
|
|
3305
3294
|
}
|
|
3306
3295
|
}
|
|
3307
3296
|
return acc;
|
|
3308
|
-
}, seed
|
|
3297
|
+
}, seed != null ? seed : []), distinctUntilArrayLengthChanges(), rxjs.shareReplay(1));
|
|
3309
3298
|
});
|
|
3310
3299
|
}
|
|
3311
3300
|
// MARK: MapForEach
|
|
@@ -3324,7 +3313,7 @@ function mapForEach(forEach) {
|
|
|
3324
3313
|
function mapEachAsync(mapFunction, config) {
|
|
3325
3314
|
const {
|
|
3326
3315
|
onlyFirst = false
|
|
3327
|
-
} = config
|
|
3316
|
+
} = config != null ? config : {};
|
|
3328
3317
|
return rxjs.switchMap(values => {
|
|
3329
3318
|
if (values.length) {
|
|
3330
3319
|
const mappedObs = values.map(mapFunction);
|
|
@@ -3351,7 +3340,7 @@ function onMatchDelta(config) {
|
|
|
3351
3340
|
to,
|
|
3352
3341
|
requireConsecutive
|
|
3353
3342
|
} = config;
|
|
3354
|
-
const isMatch = inputIsSame
|
|
3343
|
+
const isMatch = inputIsSame != null ? inputIsSame : (a, b) => a === b;
|
|
3355
3344
|
return obs => {
|
|
3356
3345
|
return obs.pipe(rxjs.scan((acc, next) => {
|
|
3357
3346
|
let emit = false;
|
|
@@ -3728,7 +3717,7 @@ function scanCount(startAt = 0) {
|
|
|
3728
3717
|
* @returns
|
|
3729
3718
|
*/
|
|
3730
3719
|
function incrementingNumberTimer(config = {}) {
|
|
3731
|
-
return factoryTimer(Object.assign(
|
|
3720
|
+
return factoryTimer(Object.assign({}, config, {
|
|
3732
3721
|
factory: util.incrementingNumberFactory(config)
|
|
3733
3722
|
}));
|
|
3734
3723
|
}
|
|
@@ -3929,7 +3918,7 @@ function errorOnEmissionsInPeriod(config) {
|
|
|
3929
3918
|
errorMessage: inputErrorMessage,
|
|
3930
3919
|
switchToObs
|
|
3931
3920
|
} = config;
|
|
3932
|
-
const errorMessage = inputErrorMessage
|
|
3921
|
+
const errorMessage = inputErrorMessage != null ? inputErrorMessage : 'errorOnEmissionsInPeriod(): Too many emissions in time period.';
|
|
3933
3922
|
const errorFactory = inputErrorFactory ? inputErrorFactory : !switchToObs ? () => new Error(errorMessage) : undefined;
|
|
3934
3923
|
return source => {
|
|
3935
3924
|
const counter = util.timePeriodCounter(period);
|
|
@@ -3937,7 +3926,7 @@ function errorOnEmissionsInPeriod(config) {
|
|
|
3937
3926
|
return source.pipe(rxjs.map(x => {
|
|
3938
3927
|
if (counter() > maxEmissionsPerPeriod) {
|
|
3939
3928
|
const error = errorFactory();
|
|
3940
|
-
onError
|
|
3929
|
+
onError == null || onError(error);
|
|
3941
3930
|
throw error;
|
|
3942
3931
|
} else {
|
|
3943
3932
|
return x;
|
|
@@ -3957,13 +3946,13 @@ function errorOnEmissionsInPeriod(config) {
|
|
|
3957
3946
|
}
|
|
3958
3947
|
|
|
3959
3948
|
function setContainsAllValuesFrom(valuesObs) {
|
|
3960
|
-
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsAllValues(set, values
|
|
3949
|
+
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsAllValues(set, values != null ? values : []));
|
|
3961
3950
|
}
|
|
3962
3951
|
function setContainsAnyValueFrom(valuesObs) {
|
|
3963
|
-
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsAnyValue(set, values
|
|
3952
|
+
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsAnyValue(set, values != null ? values : []));
|
|
3964
3953
|
}
|
|
3965
3954
|
function setContainsNoValueFrom(valuesObs) {
|
|
3966
|
-
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsNoneOfValue(set, values
|
|
3955
|
+
return combineLatestMapFrom(valuesObs, (set, values) => util.setContainsNoneOfValue(set, values != null ? values : []));
|
|
3967
3956
|
}
|
|
3968
3957
|
function distinctUntilHasDifferentValues() {
|
|
3969
3958
|
return rxjs.distinctUntilChanged(util.hasSameValues);
|
|
@@ -4034,14 +4023,31 @@ exports.LoadingStateType = void 0;
|
|
|
4034
4023
|
* @returns
|
|
4035
4024
|
*/
|
|
4036
4025
|
function loadingStateType(loadingState) {
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
} else if (util.objectHasKey(loadingState, 'error')) {
|
|
4042
|
-
return exports.LoadingStateType.ERROR;
|
|
4026
|
+
const isLoading = !isLoadingStateFinishedLoading(loadingState);
|
|
4027
|
+
let type;
|
|
4028
|
+
if (isLoading) {
|
|
4029
|
+
type = exports.LoadingStateType.LOADING;
|
|
4043
4030
|
} else {
|
|
4044
|
-
|
|
4031
|
+
if (util.objectHasKey(loadingState, 'value')) {
|
|
4032
|
+
type = exports.LoadingStateType.SUCCESS;
|
|
4033
|
+
} else if (util.objectHasKey(loadingState, 'error')) {
|
|
4034
|
+
type = exports.LoadingStateType.ERROR;
|
|
4035
|
+
} else {
|
|
4036
|
+
type = exports.LoadingStateType.IDLE;
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
return type;
|
|
4040
|
+
}
|
|
4041
|
+
function isLoadingStateFinishedLoading(state) {
|
|
4042
|
+
if (state) {
|
|
4043
|
+
const loading = state.loading;
|
|
4044
|
+
if (loading === true) {
|
|
4045
|
+
return false;
|
|
4046
|
+
} else {
|
|
4047
|
+
return loading === false || Boolean(state.value || state.error) || state.value === null;
|
|
4048
|
+
}
|
|
4049
|
+
} else {
|
|
4050
|
+
return false;
|
|
4045
4051
|
}
|
|
4046
4052
|
}
|
|
4047
4053
|
/**
|
|
@@ -4053,16 +4059,16 @@ function idleLoadingState() {
|
|
|
4053
4059
|
};
|
|
4054
4060
|
}
|
|
4055
4061
|
function beginLoading(state) {
|
|
4056
|
-
return state ? Object.assign(
|
|
4062
|
+
return state ? Object.assign({}, state, {
|
|
4057
4063
|
loading: true
|
|
4058
4064
|
}) : {
|
|
4059
4065
|
loading: true
|
|
4060
4066
|
};
|
|
4061
4067
|
}
|
|
4062
4068
|
function beginLoadingPage(page, state) {
|
|
4063
|
-
return state ? Object.assign(
|
|
4069
|
+
return state ? Object.assign({
|
|
4064
4070
|
page
|
|
4065
|
-
}, state
|
|
4071
|
+
}, state, {
|
|
4066
4072
|
loading: true
|
|
4067
4073
|
}) : {
|
|
4068
4074
|
page,
|
|
@@ -4076,7 +4082,7 @@ function successResult(value) {
|
|
|
4076
4082
|
};
|
|
4077
4083
|
}
|
|
4078
4084
|
function successPageResult(page, value) {
|
|
4079
|
-
return Object.assign(
|
|
4085
|
+
return Object.assign({}, successResult(value), {
|
|
4080
4086
|
page
|
|
4081
4087
|
});
|
|
4082
4088
|
}
|
|
@@ -4087,59 +4093,77 @@ function errorResult(error) {
|
|
|
4087
4093
|
};
|
|
4088
4094
|
}
|
|
4089
4095
|
function errorPageResult(page, error) {
|
|
4090
|
-
return Object.assign(
|
|
4096
|
+
return Object.assign({}, errorResult(error), {
|
|
4091
4097
|
page
|
|
4092
4098
|
});
|
|
4093
4099
|
}
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
function
|
|
4101
|
-
|
|
4102
|
-
return loadingStateType(state) === exports.LoadingStateType.IDLE;
|
|
4103
|
-
} else {
|
|
4104
|
-
return true;
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
function loadingStateIsLoading(state) {
|
|
4108
|
-
return !loadingStateHasFinishedLoading(state);
|
|
4109
|
-
}
|
|
4110
|
-
function isSuccessLoadingState(state) {
|
|
4111
|
-
if (state) {
|
|
4112
|
-
return loadingStateType(state) === exports.LoadingStateType.SUCCESS;
|
|
4113
|
-
} else {
|
|
4114
|
-
return false;
|
|
4115
|
-
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Returns true if any of the input LoadingStates return true for isLoadingStateLoading().
|
|
4102
|
+
*
|
|
4103
|
+
* @param states
|
|
4104
|
+
* @returns
|
|
4105
|
+
*/
|
|
4106
|
+
function isAnyLoadingStateInLoadingState(states) {
|
|
4107
|
+
return util.reduceBooleansWithOr(states.map(isLoadingStateLoading), false);
|
|
4116
4108
|
}
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4109
|
+
/**
|
|
4110
|
+
* Returns true if all input LoadingStates return true for isLoadingStateLoading().
|
|
4111
|
+
*
|
|
4112
|
+
* @param states
|
|
4113
|
+
* @returns
|
|
4114
|
+
*/
|
|
4115
|
+
function areAllLoadingStatesFinishedLoading(states) {
|
|
4116
|
+
return util.reduceBooleansWithAnd(states.map(isLoadingStateFinishedLoading), true);
|
|
4123
4117
|
}
|
|
4124
|
-
function
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
if (
|
|
4128
|
-
return
|
|
4118
|
+
function isLoadingStateWithStateType(type) {
|
|
4119
|
+
const defaultResult = type === exports.LoadingStateType.IDLE ? true : false;
|
|
4120
|
+
return state => {
|
|
4121
|
+
if (state) {
|
|
4122
|
+
return loadingStateType(state) === type;
|
|
4129
4123
|
} else {
|
|
4130
|
-
return
|
|
4124
|
+
return defaultResult;
|
|
4131
4125
|
}
|
|
4132
|
-
}
|
|
4133
|
-
return false;
|
|
4134
|
-
}
|
|
4126
|
+
};
|
|
4135
4127
|
}
|
|
4136
4128
|
/**
|
|
4137
|
-
*
|
|
4129
|
+
* Returns true if the input LoadingState passed to loadingStateType() returns IDLE.
|
|
4138
4130
|
*
|
|
4139
4131
|
* @param state
|
|
4140
4132
|
* @returns
|
|
4141
4133
|
*/
|
|
4142
|
-
|
|
4134
|
+
const isLoadingStateInIdleState = isLoadingStateWithStateType(exports.LoadingStateType.IDLE);
|
|
4135
|
+
/**
|
|
4136
|
+
* Returns true if the input LoadingState passed to loadingStateType() returns LOADING.
|
|
4137
|
+
*
|
|
4138
|
+
* @param state
|
|
4139
|
+
* @returns
|
|
4140
|
+
*/
|
|
4141
|
+
const isLoadingStateLoading = isLoadingStateWithStateType(exports.LoadingStateType.LOADING);
|
|
4142
|
+
/**
|
|
4143
|
+
* Alias of isLoadingStateLoading.
|
|
4144
|
+
*/
|
|
4145
|
+
const isLoadingStateInLoadingState = isLoadingStateLoading;
|
|
4146
|
+
/**
|
|
4147
|
+
* Returns true if the input LoadingState passed to loadingStateType() returns SUCCESS.
|
|
4148
|
+
*
|
|
4149
|
+
* @param state
|
|
4150
|
+
* @returns
|
|
4151
|
+
*/
|
|
4152
|
+
const isLoadingStateInSuccessState = isLoadingStateWithStateType(exports.LoadingStateType.SUCCESS);
|
|
4153
|
+
/**
|
|
4154
|
+
* Returns true if the input LoadingState passed to loadingStateType() returns ERROR.
|
|
4155
|
+
*
|
|
4156
|
+
* @param state
|
|
4157
|
+
* @returns
|
|
4158
|
+
*/
|
|
4159
|
+
const isLoadingStateInErrorState = isLoadingStateWithStateType(exports.LoadingStateType.ERROR);
|
|
4160
|
+
/**
|
|
4161
|
+
* Whether or not the input LoadingState has a non-undefined value.
|
|
4162
|
+
*
|
|
4163
|
+
* @param state
|
|
4164
|
+
* @returns
|
|
4165
|
+
*/
|
|
4166
|
+
function isLoadingStateWithDefinedValue(state) {
|
|
4143
4167
|
if (state) {
|
|
4144
4168
|
return state.value !== undefined;
|
|
4145
4169
|
} else {
|
|
@@ -4147,12 +4171,12 @@ function loadingStateHasValue(state) {
|
|
|
4147
4171
|
}
|
|
4148
4172
|
}
|
|
4149
4173
|
/**
|
|
4150
|
-
* Whether or not the input
|
|
4174
|
+
* Whether or not the input LoadingState has a non-null error defined. It may be loading.
|
|
4151
4175
|
*
|
|
4152
4176
|
* @param state
|
|
4153
4177
|
* @returns
|
|
4154
4178
|
*/
|
|
4155
|
-
function
|
|
4179
|
+
function isLoadingStateWithError(state) {
|
|
4156
4180
|
if (state) {
|
|
4157
4181
|
return state.error != null;
|
|
4158
4182
|
} else {
|
|
@@ -4160,27 +4184,27 @@ function loadingStateHasError(state) {
|
|
|
4160
4184
|
}
|
|
4161
4185
|
}
|
|
4162
4186
|
/**
|
|
4163
|
-
* Whether or not the input
|
|
4187
|
+
* Whether or not the input LoadingState is not loading and has a non-null value.
|
|
4164
4188
|
*
|
|
4165
4189
|
* @param state
|
|
4166
4190
|
* @returns
|
|
4167
4191
|
*/
|
|
4168
|
-
function
|
|
4192
|
+
function isLoadingStateFinishedLoadingWithDefinedValue(state) {
|
|
4169
4193
|
if (state) {
|
|
4170
|
-
return
|
|
4194
|
+
return isLoadingStateFinishedLoading(state) && state.value !== undefined;
|
|
4171
4195
|
} else {
|
|
4172
4196
|
return false;
|
|
4173
4197
|
}
|
|
4174
4198
|
}
|
|
4175
4199
|
/**
|
|
4176
|
-
* Whether or not the input
|
|
4200
|
+
* Whether or not the input LoadingState is not loading and has an error defined.
|
|
4177
4201
|
*
|
|
4178
4202
|
* @param state
|
|
4179
4203
|
* @returns
|
|
4180
4204
|
*/
|
|
4181
|
-
function
|
|
4205
|
+
function isLoadingStateFinishedLoadingWithError(state) {
|
|
4182
4206
|
if (state) {
|
|
4183
|
-
return
|
|
4207
|
+
return isLoadingStateFinishedLoading(state) && state.error != null;
|
|
4184
4208
|
} else {
|
|
4185
4209
|
return false;
|
|
4186
4210
|
}
|
|
@@ -4193,20 +4217,20 @@ function loadingStateHasFinishedLoadingWithError(state) {
|
|
|
4193
4217
|
* @param a
|
|
4194
4218
|
* @param b
|
|
4195
4219
|
*/
|
|
4196
|
-
function
|
|
4220
|
+
function isPageLoadingStateMetadataEqual(a, b) {
|
|
4197
4221
|
return util.valuesAreBothNullishOrEquivalent(a.page, b.page) && a.loading == b.loading && util.valuesAreBothNullishOrEquivalent(a.error, b.error);
|
|
4198
4222
|
}
|
|
4199
4223
|
function mergeLoadingStates(...args) {
|
|
4200
|
-
var
|
|
4224
|
+
var _loadingStates$find;
|
|
4201
4225
|
const validArgs = util.filterMaybeValues(args); // filter out any undefined values
|
|
4202
4226
|
const lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
|
|
4203
4227
|
const loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
|
|
4204
4228
|
const mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : (...inputArgs) => util.mergeObjects(inputArgs);
|
|
4205
|
-
const error = (
|
|
4229
|
+
const error = (_loadingStates$find = loadingStates.find(x => x.error)) == null ? void 0 : _loadingStates$find.error; // find the first error
|
|
4206
4230
|
let result;
|
|
4207
4231
|
if (error) {
|
|
4208
4232
|
// ignore all loading states, except for any error-prone item that is still loading
|
|
4209
|
-
const currentLoadings = loadingStates.map(x =>
|
|
4233
|
+
const currentLoadings = loadingStates.map(x => x != null && x.error ? x.loading : false);
|
|
4210
4234
|
const nonMaybeLoadings = currentLoadings.filter(x => x != null);
|
|
4211
4235
|
const loading = nonMaybeLoadings.length > 0 ? util.reduceBooleansWithOr(nonMaybeLoadings) : undefined;
|
|
4212
4236
|
result = {
|
|
@@ -4215,7 +4239,7 @@ function mergeLoadingStates(...args) {
|
|
|
4215
4239
|
error
|
|
4216
4240
|
};
|
|
4217
4241
|
} else {
|
|
4218
|
-
const loading = util.reduceBooleansWithOr(loadingStates.map(
|
|
4242
|
+
const loading = util.reduceBooleansWithOr(loadingStates.map(isLoadingStateLoading));
|
|
4219
4243
|
if (loading) {
|
|
4220
4244
|
result = {
|
|
4221
4245
|
loading: true
|
|
@@ -4232,30 +4256,30 @@ function mergeLoadingStates(...args) {
|
|
|
4232
4256
|
return result;
|
|
4233
4257
|
}
|
|
4234
4258
|
/**
|
|
4235
|
-
*
|
|
4259
|
+
* Returns a new merged state to be loading or idle, and clears the current/error value. It will have a LoadingStateType of LOADING if loading is true.
|
|
4236
4260
|
*/
|
|
4237
|
-
function
|
|
4238
|
-
return Object.assign(
|
|
4261
|
+
function mergeLoadingStateWithLoading(state, loading = true) {
|
|
4262
|
+
return Object.assign({}, state, {
|
|
4239
4263
|
value: undefined,
|
|
4240
4264
|
loading,
|
|
4241
4265
|
error: undefined
|
|
4242
4266
|
});
|
|
4243
4267
|
}
|
|
4244
4268
|
/**
|
|
4245
|
-
*
|
|
4269
|
+
* Returns a new merged state with the input value. It will have a LoadingStateType of SUCCESS now.
|
|
4246
4270
|
*/
|
|
4247
|
-
function
|
|
4248
|
-
return Object.assign(
|
|
4249
|
-
value: value
|
|
4271
|
+
function mergeLoadingStateWithValue(state, value) {
|
|
4272
|
+
return Object.assign({}, state, {
|
|
4273
|
+
value: value != null ? value : undefined,
|
|
4250
4274
|
loading: false,
|
|
4251
4275
|
error: undefined
|
|
4252
4276
|
});
|
|
4253
4277
|
}
|
|
4254
4278
|
/**
|
|
4255
|
-
*
|
|
4279
|
+
* Returns a new merged state with the input error. It will have a LoadingStateType of ERROR now.
|
|
4256
4280
|
*/
|
|
4257
|
-
function
|
|
4258
|
-
return Object.assign(
|
|
4281
|
+
function mergeLoadingStateWithError(state, error) {
|
|
4282
|
+
return Object.assign({}, state, {
|
|
4259
4283
|
loading: false,
|
|
4260
4284
|
error
|
|
4261
4285
|
});
|
|
@@ -4265,8 +4289,8 @@ function mapMultipleLoadingStateResults(input, config) {
|
|
|
4265
4289
|
mapValues,
|
|
4266
4290
|
mapState
|
|
4267
4291
|
} = config;
|
|
4268
|
-
const loading =
|
|
4269
|
-
const error = input.map(x => x
|
|
4292
|
+
const loading = isAnyLoadingStateInLoadingState(input);
|
|
4293
|
+
const error = input.map(x => x == null ? void 0 : x.error).filter(x => Boolean(x))[0];
|
|
4270
4294
|
let result;
|
|
4271
4295
|
if (!error && !loading) {
|
|
4272
4296
|
if (mapValues) {
|
|
@@ -4290,7 +4314,7 @@ function mapLoadingStateResults(input, config) {
|
|
|
4290
4314
|
mapState,
|
|
4291
4315
|
alwaysMapValue = false
|
|
4292
4316
|
} = config;
|
|
4293
|
-
const inputValue = input
|
|
4317
|
+
const inputValue = input == null ? void 0 : input.value;
|
|
4294
4318
|
let value;
|
|
4295
4319
|
if ((inputValue != null || alwaysMapValue) && mapValue) {
|
|
4296
4320
|
value = mapValue(inputValue, input);
|
|
@@ -4299,7 +4323,7 @@ function mapLoadingStateResults(input, config) {
|
|
|
4299
4323
|
}
|
|
4300
4324
|
let result;
|
|
4301
4325
|
if (!mapState) {
|
|
4302
|
-
result = Object.assign(
|
|
4326
|
+
result = Object.assign({}, input, {
|
|
4303
4327
|
value
|
|
4304
4328
|
});
|
|
4305
4329
|
} else {
|
|
@@ -4316,21 +4340,84 @@ function mapLoadingStateValueFunction(mapFn) {
|
|
|
4316
4340
|
return result;
|
|
4317
4341
|
};
|
|
4318
4342
|
}
|
|
4343
|
+
// MARK: Compat
|
|
4344
|
+
/**
|
|
4345
|
+
* @deprecated use unknownLoadingStatesIsLoading instead.
|
|
4346
|
+
*/
|
|
4347
|
+
const unknownLoadingStatesIsLoading = isAnyLoadingStateInLoadingState;
|
|
4348
|
+
/**
|
|
4349
|
+
* @deprecated use areAllLoadingStatesFinishedLoading instead.
|
|
4350
|
+
*/
|
|
4351
|
+
const allLoadingStatesHaveFinishedLoading = areAllLoadingStatesFinishedLoading;
|
|
4352
|
+
/**
|
|
4353
|
+
* @deprecated use isLoadingStateInIdleState instead.
|
|
4354
|
+
*/
|
|
4355
|
+
const loadingStateIsIdle = isLoadingStateInIdleState;
|
|
4356
|
+
/**
|
|
4357
|
+
* @deprecated use isLoadingStateInSuccessState instead.
|
|
4358
|
+
*/
|
|
4359
|
+
const isSuccessLoadingState = isLoadingStateInSuccessState;
|
|
4360
|
+
/**
|
|
4361
|
+
* @deprecated use isLoadingStateInErrorState instead.
|
|
4362
|
+
*/
|
|
4363
|
+
const isErrorLoadingState = isLoadingStateInErrorState;
|
|
4364
|
+
/**
|
|
4365
|
+
* @deprecated Use isLoadingStateLoading instead.
|
|
4366
|
+
*/
|
|
4367
|
+
const loadingStateIsLoading = isLoadingStateLoading;
|
|
4368
|
+
/**
|
|
4369
|
+
* @deprecated use isLoadingStateFinishedLoading instead.
|
|
4370
|
+
*/
|
|
4371
|
+
const loadingStateHasFinishedLoading = isLoadingStateFinishedLoading;
|
|
4372
|
+
/**
|
|
4373
|
+
* @deprecated use isLoadingStateWithError instead.
|
|
4374
|
+
*/
|
|
4375
|
+
const loadingStateHasError = isLoadingStateWithError;
|
|
4376
|
+
/**
|
|
4377
|
+
* @deprecated use isLoadingStateWithDefinedValue instead.
|
|
4378
|
+
*/
|
|
4379
|
+
const loadingStateHasValue = isLoadingStateWithDefinedValue;
|
|
4380
|
+
/**
|
|
4381
|
+
* @deprecated use isLoadingStateFinishedLoadingWithDefinedValue instead.
|
|
4382
|
+
*/
|
|
4383
|
+
const loadingStateHasFinishedLoadingWithValue = isLoadingStateFinishedLoadingWithDefinedValue;
|
|
4384
|
+
/**
|
|
4385
|
+
* @deprecated use isLoadingStateFinishedLoadingWithError instead.
|
|
4386
|
+
*/
|
|
4387
|
+
const loadingStateHasFinishedLoadingWithError = isLoadingStateFinishedLoadingWithError;
|
|
4388
|
+
/**
|
|
4389
|
+
* @deprecated use isPageLoadingStateMetadataEqual instead.
|
|
4390
|
+
*/
|
|
4391
|
+
const loadingStatesHaveEquivalentMetadata = isPageLoadingStateMetadataEqual;
|
|
4392
|
+
/**
|
|
4393
|
+
* @deprecated use mergeLoadingStateWithLoading instead.
|
|
4394
|
+
*/
|
|
4395
|
+
const updatedStateForSetLoading = mergeLoadingStateWithLoading;
|
|
4396
|
+
/**
|
|
4397
|
+
* @deprecated use updatedStateForSetValue instead.
|
|
4398
|
+
*/
|
|
4399
|
+
const updatedStateForSetValue = mergeLoadingStateWithValue;
|
|
4400
|
+
/**
|
|
4401
|
+
* @deprecated use mergeLoadingStateWithError instead.
|
|
4402
|
+
*/
|
|
4403
|
+
const updatedStateForSetError = mergeLoadingStateWithError;
|
|
4319
4404
|
|
|
4320
4405
|
/**
|
|
4321
4406
|
* Abstract LoadingContext implementation using LoadingState.
|
|
4322
4407
|
*/
|
|
4323
4408
|
class AbstractLoadingStateContextInstance {
|
|
4324
|
-
constructor(
|
|
4325
|
-
this._stateSubject
|
|
4326
|
-
this.
|
|
4409
|
+
constructor(_config) {
|
|
4410
|
+
this._stateSubject = new rxjs.BehaviorSubject(undefined);
|
|
4411
|
+
this._config = new rxjs.BehaviorSubject(undefined);
|
|
4412
|
+
this.config$ = this._config.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
4413
|
+
this.stateSubject$ = this._stateSubject.pipe(filterMaybe(), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4327
4414
|
this.state$ = this.stateSubject$.pipe(rxjs.switchMap(x => x), rxjs.shareReplay(1));
|
|
4328
|
-
this.stateObs$ = this._stateSubject
|
|
4329
|
-
this.stream$ = this.
|
|
4415
|
+
this.stateObs$ = this._stateSubject.asObservable();
|
|
4416
|
+
this.stream$ = this.stateObs$.pipe(rxjs.mergeMap(obs => {
|
|
4330
4417
|
if (obs) {
|
|
4331
4418
|
return obs.pipe(
|
|
4332
4419
|
// If the observable did not pass a value immediately, we start with the start value.
|
|
4333
|
-
timeoutStartWith(beginLoading()), rxjs.map(x => this.loadingEventForLoadingPair(x,
|
|
4420
|
+
timeoutStartWith(beginLoading()), rxjs.combineLatestWith(this.config$), rxjs.map(([x, config]) => this.loadingEventForLoadingPair(x, config)));
|
|
4334
4421
|
} else {
|
|
4335
4422
|
return rxjs.of(beginLoading());
|
|
4336
4423
|
}
|
|
@@ -4340,30 +4427,34 @@ class AbstractLoadingStateContextInstance {
|
|
|
4340
4427
|
/**
|
|
4341
4428
|
* Emits when the input state has changed.
|
|
4342
4429
|
*/
|
|
4343
|
-
this.stateChange$ = this._stateSubject
|
|
4430
|
+
this.stateChange$ = this._stateSubject.pipe(rxjs.map(() => undefined));
|
|
4344
4431
|
this.loading$ = this.stream$.pipe(rxjs.map(x => x.loading), rxjs.shareReplay(1));
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4432
|
+
let nextConfig;
|
|
4433
|
+
if (rxjs.isObservable(_config)) {
|
|
4434
|
+
nextConfig = {
|
|
4435
|
+
obs: _config
|
|
4348
4436
|
};
|
|
4349
4437
|
} else {
|
|
4350
|
-
|
|
4438
|
+
nextConfig = _config != null ? _config : {
|
|
4351
4439
|
showLoadingOnNoValue: false
|
|
4352
4440
|
};
|
|
4353
4441
|
}
|
|
4354
|
-
|
|
4355
|
-
|
|
4442
|
+
this._config.next(nextConfig);
|
|
4443
|
+
// Only set once
|
|
4444
|
+
if (nextConfig.obs) {
|
|
4445
|
+
this.setStateObs(nextConfig.obs);
|
|
4356
4446
|
}
|
|
4357
4447
|
}
|
|
4358
4448
|
setStateObs(state) {
|
|
4359
|
-
this._stateSubject
|
|
4449
|
+
this._stateSubject.next(state);
|
|
4360
4450
|
}
|
|
4361
4451
|
destroy() {
|
|
4362
|
-
this._stateSubject
|
|
4452
|
+
this._stateSubject.complete();
|
|
4453
|
+
this._config.complete();
|
|
4363
4454
|
}
|
|
4364
4455
|
}
|
|
4365
4456
|
|
|
4366
|
-
// TODO: Fix all LoadingState types to use the LoadingStateValue inference
|
|
4457
|
+
// TODO(BREAKING_CHANGE): Fix all LoadingState types to use the LoadingStateValue inference typings
|
|
4367
4458
|
/**
|
|
4368
4459
|
* Wraps an observable output and maps the value to a LoadingState.
|
|
4369
4460
|
*
|
|
@@ -4373,16 +4464,7 @@ function loadingStateFromObs(obs, firstOnly) {
|
|
|
4373
4464
|
if (firstOnly) {
|
|
4374
4465
|
obs = obs.pipe(rxjs.first());
|
|
4375
4466
|
}
|
|
4376
|
-
return obs.pipe(rxjs.map(value => (
|
|
4377
|
-
loading: false,
|
|
4378
|
-
value,
|
|
4379
|
-
error: undefined
|
|
4380
|
-
})), rxjs.catchError(error => rxjs.of({
|
|
4381
|
-
loading: false,
|
|
4382
|
-
error
|
|
4383
|
-
})), timeoutStartWith({
|
|
4384
|
-
loading: true
|
|
4385
|
-
}, 50), rxjs.shareReplay(1));
|
|
4467
|
+
return obs.pipe(rxjs.map(value => successResult(value)), rxjs.catchError(error => rxjs.of(errorResult(error))), timeoutStartWith(beginLoading(), 50), rxjs.shareReplay(1));
|
|
4386
4468
|
}
|
|
4387
4469
|
function combineLoadingStates(...args) {
|
|
4388
4470
|
const validArgs = util.filterMaybeValues(args); // filter out any undefined values
|
|
@@ -4417,7 +4499,7 @@ function combineLoadingStatesStatus(sources) {
|
|
|
4417
4499
|
if (firstErrorState) {
|
|
4418
4500
|
result = errorResult(firstErrorState.error);
|
|
4419
4501
|
} else {
|
|
4420
|
-
const oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.findIndex(
|
|
4502
|
+
const oneOrMoreStatesAreCurrentlyLoading = allLoadingStates.findIndex(isLoadingStateLoading) !== -1;
|
|
4421
4503
|
if (oneOrMoreStatesAreCurrentlyLoading) {
|
|
4422
4504
|
result = beginLoading(); // still loading
|
|
4423
4505
|
} else {
|
|
@@ -4435,7 +4517,7 @@ function startWithBeginLoading(state) {
|
|
|
4435
4517
|
*/
|
|
4436
4518
|
function valueFromLoadingState() {
|
|
4437
4519
|
return obs => {
|
|
4438
|
-
return obs.pipe(rxjs.filter(
|
|
4520
|
+
return obs.pipe(rxjs.filter(isLoadingStateWithDefinedValue), rxjs.map(x => x.value));
|
|
4439
4521
|
};
|
|
4440
4522
|
}
|
|
4441
4523
|
/**
|
|
@@ -4443,7 +4525,7 @@ function valueFromLoadingState() {
|
|
|
4443
4525
|
*/
|
|
4444
4526
|
function errorFromLoadingState() {
|
|
4445
4527
|
return obs => {
|
|
4446
|
-
return obs.pipe(rxjs.filter(
|
|
4528
|
+
return obs.pipe(rxjs.filter(isLoadingStateWithError), rxjs.map(x => x.error));
|
|
4447
4529
|
};
|
|
4448
4530
|
}
|
|
4449
4531
|
/**
|
|
@@ -4451,13 +4533,13 @@ function errorFromLoadingState() {
|
|
|
4451
4533
|
*/
|
|
4452
4534
|
function valueFromFinishedLoadingState() {
|
|
4453
4535
|
return obs => {
|
|
4454
|
-
return obs.pipe(rxjs.filter(
|
|
4536
|
+
return obs.pipe(rxjs.filter(isLoadingStateFinishedLoading), rxjs.map(x => x.value));
|
|
4455
4537
|
};
|
|
4456
4538
|
}
|
|
4457
4539
|
function tapOnLoadingStateType(fn, type) {
|
|
4458
4540
|
let decisionFunction;
|
|
4459
4541
|
if (type === exports.LoadingStateType.LOADING) {
|
|
4460
|
-
decisionFunction =
|
|
4542
|
+
decisionFunction = isLoadingStateLoading;
|
|
4461
4543
|
} else {
|
|
4462
4544
|
decisionFunction = state => loadingStateType(state) === type;
|
|
4463
4545
|
}
|
|
@@ -4477,25 +4559,25 @@ function mapLoadingStateValueWithOperator(operator, mapOnUndefined = false) {
|
|
|
4477
4559
|
return obs => {
|
|
4478
4560
|
return obs.pipe(rxjs.switchMap(state => {
|
|
4479
4561
|
let mappedObs;
|
|
4480
|
-
if (
|
|
4562
|
+
if (isLoadingStateWithDefinedValue(state) || mapOnUndefined && isLoadingStateFinishedLoading(state) && !isLoadingStateWithError(state)) {
|
|
4481
4563
|
// map the value
|
|
4482
|
-
mappedObs = rxjs.of(state.value).pipe(operator, rxjs.map(value => Object.assign(
|
|
4564
|
+
mappedObs = rxjs.of(state.value).pipe(operator, rxjs.map(value => Object.assign({}, state, {
|
|
4483
4565
|
value
|
|
4484
4566
|
})),
|
|
4485
4567
|
// if the operator does not return nearly instantly, then return the current state, minus a value
|
|
4486
|
-
timeoutStartWith(Object.assign(
|
|
4568
|
+
timeoutStartWith(Object.assign({}, state, {
|
|
4487
4569
|
loading: true,
|
|
4488
4570
|
value: undefined
|
|
4489
4571
|
}), 0));
|
|
4490
4572
|
} else {
|
|
4491
4573
|
// only pass through if there is an error, otherwise show loading.
|
|
4492
|
-
if (
|
|
4493
|
-
mappedObs = rxjs.of(Object.assign(
|
|
4574
|
+
if (isLoadingStateWithError(state)) {
|
|
4575
|
+
mappedObs = rxjs.of(Object.assign({}, state, {
|
|
4494
4576
|
value: undefined
|
|
4495
4577
|
}));
|
|
4496
4578
|
} else {
|
|
4497
4579
|
// never pass through the non-mapped state's value as-is.
|
|
4498
|
-
mappedObs = rxjs.of(Object.assign(
|
|
4580
|
+
mappedObs = rxjs.of(Object.assign({}, state, {
|
|
4499
4581
|
loading: true,
|
|
4500
4582
|
value: undefined
|
|
4501
4583
|
}));
|
|
@@ -4514,14 +4596,14 @@ function distinctLoadingState(inputConfig) {
|
|
|
4514
4596
|
} = typeof inputConfig === 'function' ? {
|
|
4515
4597
|
valueComparator: inputConfig
|
|
4516
4598
|
} : inputConfig;
|
|
4517
|
-
const passRetainedValue = inputPassRetainedValue
|
|
4518
|
-
const metadataComparator = inputMetadataComparator
|
|
4599
|
+
const passRetainedValue = inputPassRetainedValue != null ? inputPassRetainedValue : x => x !== null;
|
|
4600
|
+
const metadataComparator = inputMetadataComparator != null ? inputMetadataComparator : isPageLoadingStateMetadataEqual;
|
|
4519
4601
|
return obs => {
|
|
4520
4602
|
return obs.pipe(rxjs.scan((acc, state) => {
|
|
4521
4603
|
const nextValue = state.value;
|
|
4522
4604
|
// determine the value change
|
|
4523
4605
|
let isSameValue = false;
|
|
4524
|
-
if (
|
|
4606
|
+
if (isLoadingStateWithDefinedValue(state) || compareOnUndefinedValue && isLoadingStateFinishedLoading(state) && !isLoadingStateWithError(state)) {
|
|
4525
4607
|
// if the value is the same, then
|
|
4526
4608
|
isSameValue = valueComparator(nextValue, acc.value);
|
|
4527
4609
|
} else if (passRetainedValue(nextValue, acc.value, state, acc.previous)) {
|
|
@@ -4531,12 +4613,11 @@ function distinctLoadingState(inputConfig) {
|
|
|
4531
4613
|
const isSameLoadingStateMetadata = util.safeCompareEquality(state, acc.previous, metadataComparator);
|
|
4532
4614
|
// pick the value
|
|
4533
4615
|
const value = isSameValue ? acc.value : nextValue;
|
|
4534
|
-
const current = Object.assign(
|
|
4535
|
-
// copy all metadata over
|
|
4616
|
+
const current = Object.assign({}, state, {
|
|
4536
4617
|
value // set the new value
|
|
4537
4618
|
});
|
|
4538
4619
|
|
|
4539
|
-
return Object.assign(
|
|
4620
|
+
return Object.assign({}, acc, {
|
|
4540
4621
|
value,
|
|
4541
4622
|
isSameValue,
|
|
4542
4623
|
isSameLoadingStateMetadata,
|
|
@@ -4562,7 +4643,7 @@ function distinctLoadingState(inputConfig) {
|
|
|
4562
4643
|
* @returns
|
|
4563
4644
|
*/
|
|
4564
4645
|
function promiseFromLoadingState(obs) {
|
|
4565
|
-
return rxjs.firstValueFrom(obs.pipe(rxjs.filter(
|
|
4646
|
+
return rxjs.firstValueFrom(obs.pipe(rxjs.filter(isLoadingStateFinishedLoading))).then(x => {
|
|
4566
4647
|
let result;
|
|
4567
4648
|
if (x.error) {
|
|
4568
4649
|
throw x.error;
|
|
@@ -4573,18 +4654,22 @@ function promiseFromLoadingState(obs) {
|
|
|
4573
4654
|
});
|
|
4574
4655
|
}
|
|
4575
4656
|
|
|
4576
|
-
// TODO: breaking change refactor: Switch the names of these functions below, so the isListLoadingStateEmpty is the non-operator function.
|
|
4577
4657
|
/**
|
|
4578
4658
|
* Returns true if the loading state is not loading and is empty.
|
|
4579
4659
|
*
|
|
4580
4660
|
* @param listLoadingState
|
|
4581
4661
|
* @returns
|
|
4582
4662
|
*/
|
|
4583
|
-
function
|
|
4663
|
+
function isListLoadingStateWithEmptyValue(listLoadingState) {
|
|
4584
4664
|
return Boolean(!listLoadingState.value || !listLoadingState.value.length);
|
|
4585
4665
|
}
|
|
4586
|
-
|
|
4587
|
-
|
|
4666
|
+
/**
|
|
4667
|
+
* Convenience function that merges map() with isListLoadingStateWithEmptyValue()
|
|
4668
|
+
*
|
|
4669
|
+
* @returns
|
|
4670
|
+
*/
|
|
4671
|
+
function mapIsListLoadingStateWithEmptyValue() {
|
|
4672
|
+
return rxjs.map(isListLoadingStateWithEmptyValue);
|
|
4588
4673
|
}
|
|
4589
4674
|
/**
|
|
4590
4675
|
* Wraps an observable output and maps the value to a PageLoadingState.
|
|
@@ -4595,24 +4680,33 @@ function pageLoadingStateFromObs(obs, firstOnly, page = 0) {
|
|
|
4595
4680
|
return x;
|
|
4596
4681
|
}));
|
|
4597
4682
|
}
|
|
4683
|
+
// MARK: Compat
|
|
4684
|
+
/**
|
|
4685
|
+
* @deprecated use isListLoadingStateWithEmptyValue instead.
|
|
4686
|
+
*/
|
|
4687
|
+
const listLoadingStateIsEmpty = isListLoadingStateWithEmptyValue;
|
|
4688
|
+
/**
|
|
4689
|
+
* @deprecated use mapIsListLoadingStateWithEmptyValue instead.
|
|
4690
|
+
*/
|
|
4691
|
+
const isListLoadingStateEmpty = mapIsListLoadingStateWithEmptyValue;
|
|
4598
4692
|
|
|
4599
4693
|
/**
|
|
4600
4694
|
* LoadingContext implementation that uses a ListLoadingState observable.
|
|
4601
4695
|
*/
|
|
4602
4696
|
class ListLoadingStateContextInstance extends AbstractLoadingStateContextInstance {
|
|
4603
|
-
constructor() {
|
|
4604
|
-
super(...
|
|
4697
|
+
constructor(...args) {
|
|
4698
|
+
super(...args);
|
|
4605
4699
|
/**
|
|
4606
4700
|
* Returns the current values or an empty list.
|
|
4607
4701
|
*/
|
|
4608
4702
|
this.list$ = this.stream$.pipe(rxjs.map(x => {
|
|
4609
|
-
var
|
|
4610
|
-
return (
|
|
4703
|
+
var _x$value;
|
|
4704
|
+
return (_x$value = x.value) != null ? _x$value : [];
|
|
4611
4705
|
}), rxjs.shareReplay(1));
|
|
4612
4706
|
/**
|
|
4613
4707
|
* Returns true while loading and the current value is considered empty.
|
|
4614
4708
|
*/
|
|
4615
|
-
this.isEmptyLoading$ = this.stream$.pipe(rxjs.map(x =>
|
|
4709
|
+
this.isEmptyLoading$ = this.stream$.pipe(rxjs.map(x => isLoadingStateLoading(x) && isListLoadingStateWithEmptyValue(x)), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4616
4710
|
/**
|
|
4617
4711
|
* Whether or not the current value is empty.
|
|
4618
4712
|
*
|
|
@@ -4620,9 +4714,9 @@ class ListLoadingStateContextInstance extends AbstractLoadingStateContextInstanc
|
|
|
4620
4714
|
*
|
|
4621
4715
|
* After that, will return true if the value is empty even if loading a new value.
|
|
4622
4716
|
*/
|
|
4623
|
-
this.isEmpty$ = this.stream$.pipe(rxjs.skipWhile(x =>
|
|
4717
|
+
this.isEmpty$ = this.stream$.pipe(rxjs.skipWhile(x => isLoadingStateLoading(x)),
|
|
4624
4718
|
// skip until the first non-loading event has occured
|
|
4625
|
-
|
|
4719
|
+
mapIsListLoadingStateWithEmptyValue(), rxjs.distinctUntilChanged());
|
|
4626
4720
|
/**
|
|
4627
4721
|
* Whether or not the current value is empty and not loading.
|
|
4628
4722
|
*
|
|
@@ -4630,17 +4724,17 @@ class ListLoadingStateContextInstance extends AbstractLoadingStateContextInstanc
|
|
|
4630
4724
|
*
|
|
4631
4725
|
* After that, will return true if the value is empty even if loading a new value.
|
|
4632
4726
|
*/
|
|
4633
|
-
this.isEmptyAndNotLoading$ = this.stream$.pipe(rxjs.skipWhile(x =>
|
|
4727
|
+
this.isEmptyAndNotLoading$ = this.stream$.pipe(rxjs.skipWhile(x => isLoadingStateLoading(x)),
|
|
4634
4728
|
// skip until the first non-loading event has occured
|
|
4635
|
-
rxjs.map(x => !
|
|
4729
|
+
rxjs.map(x => !isLoadingStateLoading(x) && isListLoadingStateWithEmptyValue(x)), rxjs.distinctUntilChanged());
|
|
4636
4730
|
}
|
|
4637
4731
|
loadingEventForLoadingPair(state, config = {}) {
|
|
4638
4732
|
const {
|
|
4639
4733
|
showLoadingOnNoValue
|
|
4640
4734
|
} = config;
|
|
4641
|
-
let loading = state
|
|
4642
|
-
const error = state
|
|
4643
|
-
let value = state
|
|
4735
|
+
let loading = state == null ? void 0 : state.loading;
|
|
4736
|
+
const error = state == null ? void 0 : state.error;
|
|
4737
|
+
let value = state == null ? void 0 : state.value;
|
|
4644
4738
|
const hasValue = value != null;
|
|
4645
4739
|
if (hasValue) {
|
|
4646
4740
|
value = util.limitArray(value, config); // Always limit the value/results.
|
|
@@ -4650,7 +4744,7 @@ class ListLoadingStateContextInstance extends AbstractLoadingStateContextInstanc
|
|
|
4650
4744
|
if (showLoadingOnNoValue) {
|
|
4651
4745
|
loading = !hasValue;
|
|
4652
4746
|
} else {
|
|
4653
|
-
loading =
|
|
4747
|
+
loading = isLoadingStateLoading(state);
|
|
4654
4748
|
}
|
|
4655
4749
|
}
|
|
4656
4750
|
return {
|
|
@@ -4668,8 +4762,8 @@ function listLoadingStateContext(config) {
|
|
|
4668
4762
|
* LoadingContext implementation for a LoadingState.
|
|
4669
4763
|
*/
|
|
4670
4764
|
class LoadingStateContextInstance extends AbstractLoadingStateContextInstance {
|
|
4671
|
-
constructor() {
|
|
4672
|
-
super(...
|
|
4765
|
+
constructor(...args) {
|
|
4766
|
+
super(...args);
|
|
4673
4767
|
this.value$ = this.stream$.pipe(rxjs.map(x => x.value), rxjs.shareReplay(1));
|
|
4674
4768
|
this.valueAfterLoaded$ = this.stream$.pipe(rxjs.filter(x => !x.loading), rxjs.map(x => x.value), rxjs.shareReplay(1));
|
|
4675
4769
|
}
|
|
@@ -4677,13 +4771,13 @@ class LoadingStateContextInstance extends AbstractLoadingStateContextInstance {
|
|
|
4677
4771
|
showLoadingOnNoValue
|
|
4678
4772
|
} = {}) {
|
|
4679
4773
|
let loading = false;
|
|
4680
|
-
const error = pair
|
|
4681
|
-
const value = pair
|
|
4774
|
+
const error = pair == null ? void 0 : pair.error;
|
|
4775
|
+
const value = pair == null ? void 0 : pair.value;
|
|
4682
4776
|
if (!util.hasNonNullValue(error)) {
|
|
4683
4777
|
if (showLoadingOnNoValue) {
|
|
4684
4778
|
loading = !util.hasNonNullValue(value);
|
|
4685
4779
|
} else {
|
|
4686
|
-
loading =
|
|
4780
|
+
loading = isLoadingStateLoading(pair);
|
|
4687
4781
|
}
|
|
4688
4782
|
}
|
|
4689
4783
|
return {
|
|
@@ -4702,6 +4796,8 @@ function loadingStateContext(config) {
|
|
|
4702
4796
|
*/
|
|
4703
4797
|
class SimpleLoadingContext {
|
|
4704
4798
|
constructor(loading = true) {
|
|
4799
|
+
this._subject = void 0;
|
|
4800
|
+
this._error = void 0;
|
|
4705
4801
|
this._subject = new rxjs.BehaviorSubject({
|
|
4706
4802
|
loading
|
|
4707
4803
|
});
|
|
@@ -4743,6 +4839,7 @@ class ValuesLoadingContext extends SimpleLoadingContext {
|
|
|
4743
4839
|
loading = true
|
|
4744
4840
|
} = {}) {
|
|
4745
4841
|
super(loading);
|
|
4842
|
+
this._checkDone = void 0;
|
|
4746
4843
|
this._checkDone = checkDone;
|
|
4747
4844
|
}
|
|
4748
4845
|
/**
|
|
@@ -4767,70 +4864,113 @@ class ValuesLoadingContext extends SimpleLoadingContext {
|
|
|
4767
4864
|
}
|
|
4768
4865
|
}
|
|
4769
4866
|
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
class ItemAccumulatorInstance {
|
|
4774
|
-
constructor(itemIteration, mapItemFunction) {
|
|
4775
|
-
this.itemIteration = itemIteration;
|
|
4776
|
-
this.mapItemFunction = mapItemFunction;
|
|
4777
|
-
this.hasCompletedInitialLoad$ = this.itemIteration.firstState$.pipe(rxjs.map(() => true), rxjs.startWith(false), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4778
|
-
this.latestSuccessfulState$ = this.itemIteration.latestState$.pipe(rxjs.filter(x => !loadingStateHasError(x)), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4779
|
-
/**
|
|
4780
|
-
* All successful page results in a single array.
|
|
4781
|
-
*/
|
|
4782
|
-
this.allSuccessfulStates$ = this.latestSuccessfulState$.pipe(scanIntoArray({
|
|
4783
|
-
immutable: false
|
|
4784
|
-
}),
|
|
4785
|
-
/**
|
|
4786
|
-
* Don't wait for the first successful state in order to avoid never returning a value on immediate failures.
|
|
4787
|
-
*/
|
|
4788
|
-
rxjs.startWith([]), distinctUntilArrayLengthChanges(), rxjs.shareReplay(1));
|
|
4789
|
-
this.successfulLoadCount$ = this.allSuccessfulStates$.pipe(rxjs.map(x => x.length), rxjs.shareReplay(1));
|
|
4790
|
-
// MARK: ItemAccumulator
|
|
4791
|
-
this.currentAllItemPairs$ = this.allSuccessfulStates$.pipe(scanBuildArray(allSuccessfulStates => {
|
|
4792
|
-
const mapStateToItem = util.mapFunctionOutputPair(mapLoadingStateValueFunction(this.mapItemFunction));
|
|
4793
|
-
/*
|
|
4794
|
-
Start with allSuccessfulPageResults$ since it contains all page results since the start of the iterator,
|
|
4795
|
-
and subscription to allItems may not have started at the same time.
|
|
4796
|
-
We use scan to add in all models coming in afterwards by pushing them into the accumulator.
|
|
4797
|
-
This is to prevent performance issues with very large iteration sets, since we can
|
|
4798
|
-
append onto the array, rather than concat/copy the array each time.
|
|
4799
|
-
*/
|
|
4800
|
-
const allPageResultsUpToFirstSubscription = allSuccessfulStates;
|
|
4801
|
-
const firstLatestState = util.lastValue(allPageResultsUpToFirstSubscription);
|
|
4802
|
-
const seed = allPageResultsUpToFirstSubscription.map(mapStateToItem).filter(x => util.isMaybeSo(x.output));
|
|
4803
|
-
const accumulatorObs = this.latestSuccessfulState$.pipe(rxjs.skipWhile(x => x === firstLatestState), rxjs.map(mapStateToItem), rxjs.filter(x => util.isMaybeSo(x.output)));
|
|
4804
|
-
return {
|
|
4805
|
-
seed,
|
|
4806
|
-
accumulatorObs
|
|
4807
|
-
};
|
|
4808
|
-
}), rxjs.shareReplay(1));
|
|
4809
|
-
this.currentAllItems$ = this.currentAllItemPairs$.pipe(rxjs.map(x => x.map(y => y.output)), rxjs.shareReplay(1));
|
|
4810
|
-
this.allItemPairs$ = this.hasCompletedInitialLoad$.pipe(switchMapWhileTrue(this.currentAllItemPairs$), rxjs.shareReplay(1));
|
|
4811
|
-
this.allItems$ = this.hasCompletedInitialLoad$.pipe(switchMapWhileTrue(this.currentAllItems$), rxjs.shareReplay(1));
|
|
4812
|
-
this._sub = new SubscriptionObject(this.allSuccessfulStates$.subscribe());
|
|
4867
|
+
function _await$1(value, then, direct) {
|
|
4868
|
+
if (direct) {
|
|
4869
|
+
return then ? then(value) : value;
|
|
4813
4870
|
}
|
|
4814
|
-
|
|
4815
|
-
|
|
4871
|
+
if (!value || !value.then) {
|
|
4872
|
+
value = Promise.resolve(value);
|
|
4816
4873
|
}
|
|
4874
|
+
return then ? value.then(then) : value;
|
|
4875
|
+
} /**
|
|
4876
|
+
* Automatically calls next on the accumulator's page item iteration up to the target number of results. Returns the total number of items loaded.
|
|
4877
|
+
*
|
|
4878
|
+
* The promise will reject with an error if an error is encountered.
|
|
4879
|
+
*
|
|
4880
|
+
* @param iteration
|
|
4881
|
+
* @param maxResultsLimit
|
|
4882
|
+
* @returns
|
|
4883
|
+
*/
|
|
4884
|
+
|
|
4885
|
+
function _async$1(f) {
|
|
4886
|
+
return function () {
|
|
4887
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
4888
|
+
args[i] = arguments[i];
|
|
4889
|
+
}
|
|
4890
|
+
try {
|
|
4891
|
+
return Promise.resolve(f.apply(this, args));
|
|
4892
|
+
} catch (e) {
|
|
4893
|
+
return Promise.reject(e);
|
|
4894
|
+
}
|
|
4895
|
+
};
|
|
4817
4896
|
}
|
|
4818
|
-
function
|
|
4819
|
-
if (
|
|
4820
|
-
|
|
4897
|
+
function _call(body, then, direct) {
|
|
4898
|
+
if (direct) {
|
|
4899
|
+
return then ? then(body()) : body();
|
|
4821
4900
|
}
|
|
4822
|
-
|
|
4901
|
+
try {
|
|
4902
|
+
var result = Promise.resolve(body());
|
|
4903
|
+
return then ? result.then(then) : result;
|
|
4904
|
+
} catch (e) {
|
|
4905
|
+
return Promise.reject(e);
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
function itemAccumulator(itemIteration, inputMapItem) {
|
|
4909
|
+
const mapItemFunction = inputMapItem != null ? inputMapItem : a => a;
|
|
4910
|
+
const hasCompletedInitialLoad$ = itemIteration.firstState$.pipe(rxjs.map(() => true), rxjs.startWith(false), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4911
|
+
const latestSuccessfulState$ = itemIteration.latestState$.pipe(rxjs.filter(x => !isLoadingStateWithError(x)), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
4912
|
+
const allSuccessfulStates$ = latestSuccessfulState$.pipe(scanIntoArray({
|
|
4913
|
+
immutable: false
|
|
4914
|
+
}),
|
|
4915
|
+
/**
|
|
4916
|
+
* Don't wait for the first successful state in order to avoid never returning a value on immediate failures.
|
|
4917
|
+
*/
|
|
4918
|
+
rxjs.startWith([]), distinctUntilArrayLengthChanges(), rxjs.shareReplay(1));
|
|
4919
|
+
const successfulLoadCount$ = allSuccessfulStates$.pipe(rxjs.map(x => x.length), rxjs.shareReplay(1));
|
|
4920
|
+
// MARK: ItemAccumulator
|
|
4921
|
+
const currentAllItemPairs$ = allSuccessfulStates$.pipe(scanBuildArray(allSuccessfulStates => {
|
|
4922
|
+
const mapStateToItem = util.mapFunctionOutputPair(mapLoadingStateValueFunction(mapItemFunction));
|
|
4923
|
+
/*
|
|
4924
|
+
Start with allSuccessfulPageResults$ since it contains all page results since the start of the iterator,
|
|
4925
|
+
and subscription to allItems may not have started at the same time.
|
|
4926
|
+
We use scan to add in all models coming in afterwards by pushing them into the accumulator.
|
|
4927
|
+
This is to prevent performance issues with very large iteration sets, since we can
|
|
4928
|
+
append onto the array, rather than concat/copy the array each time.
|
|
4929
|
+
*/
|
|
4930
|
+
const allPageResultsUpToFirstSubscription = allSuccessfulStates;
|
|
4931
|
+
const firstLatestState = util.lastValue(allPageResultsUpToFirstSubscription);
|
|
4932
|
+
const seed = allPageResultsUpToFirstSubscription.map(mapStateToItem).filter(x => util.isMaybeSo(x.output));
|
|
4933
|
+
const accumulatorObs = latestSuccessfulState$.pipe(rxjs.skipWhile(x => x === firstLatestState), rxjs.map(mapStateToItem), rxjs.filter(x => util.isMaybeSo(x.output)));
|
|
4934
|
+
return {
|
|
4935
|
+
seed,
|
|
4936
|
+
accumulatorObs
|
|
4937
|
+
};
|
|
4938
|
+
}), rxjs.shareReplay(1));
|
|
4939
|
+
const currentAllItems$ = currentAllItemPairs$.pipe(rxjs.map(x => x.map(y => y.output)), rxjs.shareReplay(1));
|
|
4940
|
+
const allItemPairs$ = hasCompletedInitialLoad$.pipe(switchMapWhileTrue(currentAllItemPairs$), rxjs.shareReplay(1));
|
|
4941
|
+
const allItems$ = hasCompletedInitialLoad$.pipe(switchMapWhileTrue(currentAllItems$), rxjs.shareReplay(1));
|
|
4942
|
+
const sub = new SubscriptionObject(allSuccessfulStates$.subscribe());
|
|
4943
|
+
const destroy = () => sub.destroy();
|
|
4944
|
+
const result = {
|
|
4945
|
+
itemIteration,
|
|
4946
|
+
mapItemFunction,
|
|
4947
|
+
hasCompletedInitialLoad$,
|
|
4948
|
+
latestSuccessfulState$,
|
|
4949
|
+
allSuccessfulStates$,
|
|
4950
|
+
successfulLoadCount$,
|
|
4951
|
+
currentAllItemPairs$,
|
|
4952
|
+
currentAllItems$,
|
|
4953
|
+
allItemPairs$,
|
|
4954
|
+
allItems$,
|
|
4955
|
+
destroy
|
|
4956
|
+
};
|
|
4957
|
+
return result;
|
|
4823
4958
|
}
|
|
4824
|
-
/**
|
|
4825
|
-
* Automatically calls next on the accumulator's page item iteration up to the target number of results. Returns the total number of items loaded.
|
|
4826
|
-
*
|
|
4827
|
-
* The promise will reject with an error if an error is encountered.
|
|
4828
|
-
*
|
|
4829
|
-
* @param iteration
|
|
4830
|
-
* @param maxResultsLimit
|
|
4831
|
-
* @returns
|
|
4832
|
-
*/
|
|
4833
4959
|
function itemAccumulatorNextPageUntilResultsCount(config) {
|
|
4960
|
+
const checkResultsLimit = _async$1(function () {
|
|
4961
|
+
return _await$1(rxjs.firstValueFrom(accumulator.currentAllItems$), function (allItems) {
|
|
4962
|
+
return _await$1(rxjs.firstValueFrom(canLoadMoreObs), function (canLoadMore) {
|
|
4963
|
+
return _await$1(countResults(allItems), function (currentCount) {
|
|
4964
|
+
const maxResultsLimit = getMaxResultsLimit();
|
|
4965
|
+
const shouldContinue = canLoadMore && currentCount < maxResultsLimit;
|
|
4966
|
+
return {
|
|
4967
|
+
shouldContinue,
|
|
4968
|
+
currentCount
|
|
4969
|
+
};
|
|
4970
|
+
});
|
|
4971
|
+
});
|
|
4972
|
+
});
|
|
4973
|
+
});
|
|
4834
4974
|
const {
|
|
4835
4975
|
accumulator,
|
|
4836
4976
|
maxResultsLimit,
|
|
@@ -4840,30 +4980,18 @@ function itemAccumulatorNextPageUntilResultsCount(config) {
|
|
|
4840
4980
|
const canLoadMoreObs = iterationHasNextAndCanLoadMore(accumulator.itemIteration).pipe(timeoutStartWith(false, 100),
|
|
4841
4981
|
// TODO: This can fail to emit anything if the iterator has been destroyed
|
|
4842
4982
|
rxjs.shareReplay(1));
|
|
4843
|
-
function checkResultsLimit() {
|
|
4844
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4845
|
-
const allItems = yield rxjs.firstValueFrom(accumulator.currentAllItems$);
|
|
4846
|
-
const canLoadMore = yield rxjs.firstValueFrom(canLoadMoreObs);
|
|
4847
|
-
const currentCount = yield countResults(allItems);
|
|
4848
|
-
const maxResultsLimit = getMaxResultsLimit();
|
|
4849
|
-
const shouldContinue = canLoadMore && currentCount < maxResultsLimit;
|
|
4850
|
-
return {
|
|
4851
|
-
shouldContinue,
|
|
4852
|
-
currentCount
|
|
4853
|
-
};
|
|
4854
|
-
});
|
|
4855
|
-
}
|
|
4856
4983
|
return new Promise((resolve, reject) => {
|
|
4857
4984
|
accumulator.currentAllItems$.pipe(rxjs.first(), rxjs.switchMap(allItems => rxjs.from(util.asPromise(countResults(allItems))))).subscribe({
|
|
4858
|
-
next:
|
|
4985
|
+
next: _async$1(function (currentResultsCount) {
|
|
4859
4986
|
util.performTaskLoop({
|
|
4860
4987
|
initValue: currentResultsCount,
|
|
4861
|
-
checkContinue: (x, i)
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4988
|
+
checkContinue: function (x, i) {
|
|
4989
|
+
return _call(checkResultsLimit, function (result) {
|
|
4990
|
+
currentResultsCount = result.currentCount;
|
|
4991
|
+
return result.shouldContinue;
|
|
4992
|
+
});
|
|
4993
|
+
},
|
|
4994
|
+
next: _async$1(function () {
|
|
4867
4995
|
return accumulator.itemIteration.nextPage();
|
|
4868
4996
|
})
|
|
4869
4997
|
}).then(page => {
|
|
@@ -4875,6 +5003,7 @@ function itemAccumulatorNextPageUntilResultsCount(config) {
|
|
|
4875
5003
|
reject(error);
|
|
4876
5004
|
throw error;
|
|
4877
5005
|
});
|
|
5006
|
+
return _await$1();
|
|
4878
5007
|
}),
|
|
4879
5008
|
error: error => {
|
|
4880
5009
|
reject(error);
|
|
@@ -4893,7 +5022,7 @@ function flattenAccumulatorResultItemArray(accumulator) {
|
|
|
4893
5022
|
return accumulator.currentAllItemPairs$.pipe(scanBuildArray(allItems => {
|
|
4894
5023
|
const pairs = allItems;
|
|
4895
5024
|
const firstLatestItemPair = util.lastValue(allItems);
|
|
4896
|
-
const skipValue = firstLatestItemPair
|
|
5025
|
+
const skipValue = firstLatestItemPair == null ? void 0 : firstLatestItemPair.input;
|
|
4897
5026
|
const seed = util.flattenArray(pairs.map(x => x.output));
|
|
4898
5027
|
const mapStateToItem = mapLoadingStateValueFunction(accumulator.mapItemFunction);
|
|
4899
5028
|
const accumulatorObs = accumulator.itemIteration.latestState$.pipe(rxjs.skipWhile(x => x.value === skipValue), rxjs.map(mapStateToItem), filterMaybe());
|
|
@@ -4934,6 +5063,13 @@ function pageItemAccumulatorCurrentPage(pageItemAccumulator) {
|
|
|
4934
5063
|
|
|
4935
5064
|
class MappedItemIterationInstance {
|
|
4936
5065
|
constructor(itemIterator, config) {
|
|
5066
|
+
this.itemIterator = void 0;
|
|
5067
|
+
this.config = void 0;
|
|
5068
|
+
this.hasNext$ = void 0;
|
|
5069
|
+
this.canLoadMore$ = void 0;
|
|
5070
|
+
this.firstState$ = void 0;
|
|
5071
|
+
this.latestState$ = void 0;
|
|
5072
|
+
this.currentState$ = void 0;
|
|
4937
5073
|
this.itemIterator = itemIterator;
|
|
4938
5074
|
this.config = config;
|
|
4939
5075
|
this.hasNext$ = this.itemIterator.hasNext$;
|
|
@@ -4966,8 +5102,8 @@ function mapItemIteration(itemIteration, config) {
|
|
|
4966
5102
|
* MappedItemIterationInstance extension that implements PageItemIteration.
|
|
4967
5103
|
*/
|
|
4968
5104
|
class MappedPageItemIterationInstance extends MappedItemIterationInstance {
|
|
4969
|
-
constructor() {
|
|
4970
|
-
super(...
|
|
5105
|
+
constructor(...args) {
|
|
5106
|
+
super(...args);
|
|
4971
5107
|
this.latestLoadedPage$ = this.itemIterator.latestLoadedPage$;
|
|
4972
5108
|
}
|
|
4973
5109
|
// MARK: PageItemIteration
|
|
@@ -4996,10 +5132,32 @@ function mapPageItemIteration(itemIteration, config) {
|
|
|
4996
5132
|
/**
|
|
4997
5133
|
* Default number of pages that can be loaded.
|
|
4998
5134
|
*/
|
|
5135
|
+
|
|
5136
|
+
function _await(value, then, direct) {
|
|
5137
|
+
if (direct) {
|
|
5138
|
+
return then ? then(value) : value;
|
|
5139
|
+
}
|
|
5140
|
+
if (!value || !value.then) {
|
|
5141
|
+
value = Promise.resolve(value);
|
|
5142
|
+
}
|
|
5143
|
+
return then ? value.then(then) : value;
|
|
5144
|
+
} /**
|
|
5145
|
+
* Used for generating new iterations.
|
|
5146
|
+
*/
|
|
5147
|
+
|
|
5148
|
+
function _async(f) {
|
|
5149
|
+
return function () {
|
|
5150
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5151
|
+
args[i] = arguments[i];
|
|
5152
|
+
}
|
|
5153
|
+
try {
|
|
5154
|
+
return Promise.resolve(f.apply(this, args));
|
|
5155
|
+
} catch (e) {
|
|
5156
|
+
return Promise.reject(e);
|
|
5157
|
+
}
|
|
5158
|
+
};
|
|
5159
|
+
}
|
|
4999
5160
|
const DEFAULT_ITEM_PAGE_ITERATOR_MAX = 100;
|
|
5000
|
-
/**
|
|
5001
|
-
* Used for generating new iterations.
|
|
5002
|
-
*/
|
|
5003
5161
|
class ItemPageIterator {
|
|
5004
5162
|
get maxPageLoadLimit() {
|
|
5005
5163
|
return this._maxPageLoadLimit;
|
|
@@ -5008,6 +5166,8 @@ class ItemPageIterator {
|
|
|
5008
5166
|
this._maxPageLoadLimit = maxPageLoadLimit;
|
|
5009
5167
|
}
|
|
5010
5168
|
constructor(delegate) {
|
|
5169
|
+
this.delegate = void 0;
|
|
5170
|
+
this._maxPageLoadLimit = void 0;
|
|
5011
5171
|
this.delegate = delegate;
|
|
5012
5172
|
}
|
|
5013
5173
|
/**
|
|
@@ -5025,16 +5185,16 @@ class ItemPageIterator {
|
|
|
5025
5185
|
*/
|
|
5026
5186
|
class ItemPageIterationInstance {
|
|
5027
5187
|
constructor(iterator, config) {
|
|
5028
|
-
var
|
|
5029
|
-
this.iterator =
|
|
5030
|
-
this.config =
|
|
5188
|
+
var _this$config$maxPageL;
|
|
5189
|
+
this.iterator = void 0;
|
|
5190
|
+
this.config = void 0;
|
|
5031
5191
|
/**
|
|
5032
5192
|
* Used for triggering loading of more content.
|
|
5033
5193
|
*/
|
|
5034
5194
|
this._next = new rxjs.BehaviorSubject({
|
|
5035
5195
|
n: 0
|
|
5036
5196
|
});
|
|
5037
|
-
this._maxPageLoadLimit = new rxjs.BehaviorSubject(
|
|
5197
|
+
this._maxPageLoadLimit = new rxjs.BehaviorSubject(undefined);
|
|
5038
5198
|
// MARK: State
|
|
5039
5199
|
this.state$ = this._next.pipe(rxjs.delay(0), rxjs.exhaustMap(request => rxjs.combineLatest([this.hasNextAndCanLoadMore$, this._lastFinishedPageResultState$]).pipe(rxjs.first(), rxjs.map(([hasNextAndCanLoadMore, prevResult]) => [itemPageIteratorShouldLoadNextPage(request, hasNextAndCanLoadMore, prevResult), prevResult]), rxjs.mergeMap(([shouldLoadNextPage, prevResult]) => {
|
|
5040
5200
|
if (shouldLoadNextPage) {
|
|
@@ -5083,13 +5243,13 @@ class ItemPageIterationInstance {
|
|
|
5083
5243
|
};
|
|
5084
5244
|
// If it was a replay of the previous result, change nothing.
|
|
5085
5245
|
if (acc.current !== curr) {
|
|
5086
|
-
if (
|
|
5246
|
+
if (isLoadingStateFinishedLoading(curr)) {
|
|
5087
5247
|
// only set first finished once
|
|
5088
5248
|
if (!next.firstFinished) {
|
|
5089
5249
|
next.firstFinished = curr;
|
|
5090
5250
|
}
|
|
5091
5251
|
next.latestFinished = curr;
|
|
5092
|
-
if (!
|
|
5252
|
+
if (!isLoadingStateWithError(curr)) {
|
|
5093
5253
|
next.lastSuccessful = curr;
|
|
5094
5254
|
if (!next.firstSuccessful) {
|
|
5095
5255
|
next.firstSuccessful = curr;
|
|
@@ -5118,7 +5278,7 @@ class ItemPageIterationInstance {
|
|
|
5118
5278
|
/**
|
|
5119
5279
|
* Same as _nextTrigger$, but catches finished loading events.
|
|
5120
5280
|
*/
|
|
5121
|
-
this._nextFinished$ = this._nextTrigger$.pipe(rxjs.filter(x =>
|
|
5281
|
+
this._nextFinished$ = this._nextTrigger$.pipe(rxjs.filter(x => isLoadingStateFinishedLoading(x.current)));
|
|
5122
5282
|
/**
|
|
5123
5283
|
* The first page results that finished loading.
|
|
5124
5284
|
*/
|
|
@@ -5145,10 +5305,10 @@ class ItemPageIterationInstance {
|
|
|
5145
5305
|
/**
|
|
5146
5306
|
* Whether or not items are currently being loaded.
|
|
5147
5307
|
*/
|
|
5148
|
-
this.isLoading$ = this._currentPageResultState$.pipe(rxjs.map(x =>
|
|
5308
|
+
this.isLoading$ = this._currentPageResultState$.pipe(rxjs.map(x => isLoadingStateLoading(x)), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
5149
5309
|
this._lastFinishedPageResultState$ = this.latestPageResultState$.pipe(rxjs.startWith(undefined), rxjs.shareReplay(1));
|
|
5150
|
-
this._lastFinishedPageResult$ = this._lastFinishedPageResultState$.pipe(rxjs.map(x => x
|
|
5151
|
-
this._lastFinishedPageResultItem$ = this._lastFinishedPageResult$.pipe(rxjs.map(x => x
|
|
5310
|
+
this._lastFinishedPageResult$ = this._lastFinishedPageResultState$.pipe(rxjs.map(x => x == null ? void 0 : x.value));
|
|
5311
|
+
this._lastFinishedPageResultItem$ = this._lastFinishedPageResult$.pipe(rxjs.map(x => x == null ? void 0 : x.value));
|
|
5152
5312
|
/**
|
|
5153
5313
|
* The first page results that has finished loading without an error.
|
|
5154
5314
|
*/
|
|
@@ -5176,6 +5336,9 @@ class ItemPageIterationInstance {
|
|
|
5176
5336
|
this.firstState$ = this.firstPageResultState$.pipe(mapItemPageLoadingStateFromResultPageLoadingState(), rxjs.shareReplay(1));
|
|
5177
5337
|
this.latestState$ = this.latestPageResultState$.pipe(mapItemPageLoadingStateFromResultPageLoadingState(), rxjs.shareReplay(1));
|
|
5178
5338
|
this.latestItems$ = this.latestState$.pipe(rxjs.distinctUntilChanged(), rxjs.map(x => x.value), rxjs.shareReplay(1));
|
|
5339
|
+
this.iterator = iterator;
|
|
5340
|
+
this.config = config;
|
|
5341
|
+
this._maxPageLoadLimit.next((_this$config$maxPageL = this.config.maxPageLoadLimit) != null ? _this$config$maxPageL : this.iterator.maxPageLoadLimit);
|
|
5179
5342
|
}
|
|
5180
5343
|
// MARK: PageItemIteration
|
|
5181
5344
|
get maxPageLoadLimit() {
|
|
@@ -5186,8 +5349,9 @@ class ItemPageIterationInstance {
|
|
|
5186
5349
|
this._maxPageLoadLimit.next(limit);
|
|
5187
5350
|
}
|
|
5188
5351
|
nextPage(request = {}) {
|
|
5189
|
-
|
|
5190
|
-
|
|
5352
|
+
const _this = this;
|
|
5353
|
+
return new Promise(_async(function (resolve, reject) {
|
|
5354
|
+
_this._nextFinished$.pipe(rxjs.exhaustMap(() => _this.latestPageResultState$), rxjs.defaultIfEmpty({
|
|
5191
5355
|
error: undefined,
|
|
5192
5356
|
page: -1
|
|
5193
5357
|
}), rxjs.first()).subscribe({
|
|
@@ -5202,7 +5366,8 @@ class ItemPageIterationInstance {
|
|
|
5202
5366
|
reject(error);
|
|
5203
5367
|
}
|
|
5204
5368
|
});
|
|
5205
|
-
|
|
5369
|
+
_this.next(request);
|
|
5370
|
+
return _await();
|
|
5206
5371
|
}));
|
|
5207
5372
|
}
|
|
5208
5373
|
next(request = {}) {
|
|
@@ -5243,13 +5408,13 @@ function isItemPageIteratorResultEndResult(result) {
|
|
|
5243
5408
|
function itemPageIteratorShouldLoadNextPage(request, hasNextAndCanLoadMore, prevResult) {
|
|
5244
5409
|
return hasNextAndCanLoadMore &&
|
|
5245
5410
|
// Must be able to load more
|
|
5246
|
-
Boolean(!
|
|
5411
|
+
Boolean(!isLoadingStateWithError(prevResult) || request.retry) &&
|
|
5247
5412
|
// Must not have any errors
|
|
5248
5413
|
Boolean(request.page == null || nextIteratorPageNumber(prevResult) === request.page); // Must match the page, if provided
|
|
5249
5414
|
}
|
|
5250
5415
|
|
|
5251
5416
|
function nextIteratorPageNumber(prevResult) {
|
|
5252
|
-
return
|
|
5417
|
+
return isLoadingStateWithError(prevResult) ? prevResult.page : util.getNextPageNumber(prevResult);
|
|
5253
5418
|
}
|
|
5254
5419
|
function mapItemPageLoadingStateFromResultPageLoadingState() {
|
|
5255
5420
|
return rxjs.map(itemPageLoadingStateFromResultPageLoadingState);
|
|
@@ -5270,8 +5435,8 @@ function onLockSetNextUnlock({
|
|
|
5270
5435
|
timeout: inputTimeout,
|
|
5271
5436
|
delayTime
|
|
5272
5437
|
}) {
|
|
5273
|
-
const timeoutTime = inputTimeout
|
|
5274
|
-
return lockSet.isUnlocked$.pipe(rxjs.filter(x => x), rxjs.delay(delayTime
|
|
5438
|
+
const timeoutTime = inputTimeout != null ? inputTimeout : util.MS_IN_SECOND * 50;
|
|
5439
|
+
return lockSet.isUnlocked$.pipe(rxjs.filter(x => x), rxjs.delay(delayTime != null ? delayTime : 0), rxjs.timeout({
|
|
5275
5440
|
first: timeoutTime,
|
|
5276
5441
|
with: () => rxjs.of(false).pipe(rxjs.tap(() => console.warn('LockSet time out. Potential issue detected.')))
|
|
5277
5442
|
}), rxjs.first()).subscribe(fn);
|
|
@@ -5298,13 +5463,12 @@ class LockSet {
|
|
|
5298
5463
|
return this._locks.value;
|
|
5299
5464
|
}
|
|
5300
5465
|
setLocked(key, config, duration) {
|
|
5301
|
-
var _a;
|
|
5302
5466
|
let lockedConfig;
|
|
5303
5467
|
if (typeof config === 'object') {
|
|
5304
5468
|
lockedConfig = config;
|
|
5305
5469
|
} else {
|
|
5306
5470
|
lockedConfig = {
|
|
5307
|
-
locked:
|
|
5471
|
+
locked: config != null ? config : true,
|
|
5308
5472
|
duration
|
|
5309
5473
|
};
|
|
5310
5474
|
}
|
|
@@ -5325,7 +5489,7 @@ class LockSet {
|
|
|
5325
5489
|
this.lockForTime(seconds * 1000);
|
|
5326
5490
|
}
|
|
5327
5491
|
lockForTime(milliseconds, key) {
|
|
5328
|
-
this.addLock(key
|
|
5492
|
+
this.addLock(key != null ? key : DEFAULT_LOCK_SET_TIME_LOCK_KEY, rxjs.of(false).pipe(rxjs.delay(milliseconds), rxjs.startWith(true)));
|
|
5329
5493
|
}
|
|
5330
5494
|
addLock(key, obs) {
|
|
5331
5495
|
obs = obs.pipe(rxjs.defaultIfEmpty(false) // empty observables count as unlocked.
|
|
@@ -5363,7 +5527,7 @@ class LockSet {
|
|
|
5363
5527
|
}
|
|
5364
5528
|
return removeFn;
|
|
5365
5529
|
}), cleanup(removeLockSet => {
|
|
5366
|
-
removeLockSet
|
|
5530
|
+
removeLockSet == null || removeLockSet();
|
|
5367
5531
|
})).subscribe();
|
|
5368
5532
|
}
|
|
5369
5533
|
/**
|
|
@@ -5384,9 +5548,9 @@ class LockSet {
|
|
|
5384
5548
|
mergeConfig = config;
|
|
5385
5549
|
}
|
|
5386
5550
|
}
|
|
5387
|
-
this.onNextUnlock(Object.assign(
|
|
5551
|
+
this.onNextUnlock(Object.assign({}, mergeConfig, {
|
|
5388
5552
|
fn: unlocked => {
|
|
5389
|
-
fn
|
|
5553
|
+
fn == null || fn(unlocked);
|
|
5390
5554
|
setTimeout(() => this.destroy(), 100);
|
|
5391
5555
|
},
|
|
5392
5556
|
delayTime
|
|
@@ -5404,15 +5568,18 @@ LockSet.LOCK_SET_CHILD_INDEX_STEPPER = 0;
|
|
|
5404
5568
|
*/
|
|
5405
5569
|
class WorkInstance {
|
|
5406
5570
|
constructor(value, delegate) {
|
|
5407
|
-
this.value =
|
|
5408
|
-
this.delegate =
|
|
5571
|
+
this.value = void 0;
|
|
5572
|
+
this.delegate = void 0;
|
|
5409
5573
|
this._done = false;
|
|
5410
5574
|
this._doneActionBegan = false;
|
|
5575
|
+
this._result = void 0;
|
|
5411
5576
|
this._loadingState = new rxjs.BehaviorSubject(undefined);
|
|
5412
5577
|
this._sub = new SubscriptionObject();
|
|
5413
5578
|
this.loadingState$ = this._loadingState.pipe(filterMaybe());
|
|
5414
5579
|
this._hasStarted$ = this._loadingState.pipe(rxjs.map(x => Boolean(x)), rxjs.shareReplay(1));
|
|
5415
|
-
this._isComplete$ = this.loadingState$.pipe(rxjs.map(x =>
|
|
5580
|
+
this._isComplete$ = this.loadingState$.pipe(rxjs.map(x => isLoadingStateFinishedLoading(x)), rxjs.shareReplay(1));
|
|
5581
|
+
this.value = value;
|
|
5582
|
+
this.delegate = delegate;
|
|
5416
5583
|
// Schedule to cleanup self once isComplete is true.
|
|
5417
5584
|
this.result$.subscribe(loadingState => {
|
|
5418
5585
|
this._result = loadingState;
|
|
@@ -5426,7 +5593,7 @@ class WorkInstance {
|
|
|
5426
5593
|
return this._done ? rxjs.of(this._doneActionBegan) : this._hasStarted$;
|
|
5427
5594
|
}
|
|
5428
5595
|
get isComplete() {
|
|
5429
|
-
return this._done ||
|
|
5596
|
+
return this._done || isLoadingStateFinishedLoading(this._loadingState.value);
|
|
5430
5597
|
}
|
|
5431
5598
|
get isComplete$() {
|
|
5432
5599
|
return this._done ? rxjs.of(true) : this._isComplete$;
|
|
@@ -5449,7 +5616,7 @@ class WorkInstance {
|
|
|
5449
5616
|
this._sub.subscription = obs.pipe(rxjs.delay(0),
|
|
5450
5617
|
// delay to prevent an immediate start working, which can override the _sub.subscription value
|
|
5451
5618
|
rxjs.first()).subscribe(() => {
|
|
5452
|
-
this.startWorkingWithObservable(obs.pipe(rxjs.filter(x => x && !
|
|
5619
|
+
this.startWorkingWithObservable(obs.pipe(rxjs.filter(x => x && !isLoadingStateLoading(x)),
|
|
5453
5620
|
// don't return until it has finished loading.
|
|
5454
5621
|
rxjs.map(x => {
|
|
5455
5622
|
if (x.error) {
|
|
@@ -5607,7 +5774,6 @@ exports.FilterMapKeyInstance = FilterMapKeyInstance;
|
|
|
5607
5774
|
exports.FilterSource = FilterSource;
|
|
5608
5775
|
exports.FilterSourceConnector = FilterSourceConnector;
|
|
5609
5776
|
exports.FilterSourceInstance = FilterSourceInstance;
|
|
5610
|
-
exports.ItemAccumulatorInstance = ItemAccumulatorInstance;
|
|
5611
5777
|
exports.ItemPageIterationInstance = ItemPageIterationInstance;
|
|
5612
5778
|
exports.ItemPageIterator = ItemPageIterator;
|
|
5613
5779
|
exports.ListLoadingStateContextInstance = ListLoadingStateContextInstance;
|
|
@@ -5624,6 +5790,7 @@ exports.WorkInstance = WorkInstance;
|
|
|
5624
5790
|
exports.accumulatorCurrentPageListLoadingState = accumulatorCurrentPageListLoadingState;
|
|
5625
5791
|
exports.accumulatorFlattenPageListLoadingState = accumulatorFlattenPageListLoadingState;
|
|
5626
5792
|
exports.allLoadingStatesHaveFinishedLoading = allLoadingStatesHaveFinishedLoading;
|
|
5793
|
+
exports.areAllLoadingStatesFinishedLoading = areAllLoadingStatesFinishedLoading;
|
|
5627
5794
|
exports.asObservable = asObservable;
|
|
5628
5795
|
exports.asObservableFromGetter = asObservableFromGetter;
|
|
5629
5796
|
exports.asyncPusher = asyncPusher;
|
|
@@ -5667,11 +5834,25 @@ exports.idleLoadingState = idleLoadingState;
|
|
|
5667
5834
|
exports.incrementingNumberTimer = incrementingNumberTimer;
|
|
5668
5835
|
exports.initialize = initialize;
|
|
5669
5836
|
exports.invertObservableDecision = invertObservableDecision;
|
|
5837
|
+
exports.isAnyLoadingStateInLoadingState = isAnyLoadingStateInLoadingState;
|
|
5670
5838
|
exports.isErrorLoadingState = isErrorLoadingState;
|
|
5671
5839
|
exports.isItemPageIteratorResultEndResult = isItemPageIteratorResultEndResult;
|
|
5672
5840
|
exports.isListLoadingStateEmpty = isListLoadingStateEmpty;
|
|
5841
|
+
exports.isListLoadingStateWithEmptyValue = isListLoadingStateWithEmptyValue;
|
|
5673
5842
|
exports.isLoading = isLoading;
|
|
5843
|
+
exports.isLoadingStateFinishedLoading = isLoadingStateFinishedLoading;
|
|
5844
|
+
exports.isLoadingStateFinishedLoadingWithDefinedValue = isLoadingStateFinishedLoadingWithDefinedValue;
|
|
5845
|
+
exports.isLoadingStateFinishedLoadingWithError = isLoadingStateFinishedLoadingWithError;
|
|
5846
|
+
exports.isLoadingStateInErrorState = isLoadingStateInErrorState;
|
|
5847
|
+
exports.isLoadingStateInIdleState = isLoadingStateInIdleState;
|
|
5848
|
+
exports.isLoadingStateInLoadingState = isLoadingStateInLoadingState;
|
|
5849
|
+
exports.isLoadingStateInSuccessState = isLoadingStateInSuccessState;
|
|
5850
|
+
exports.isLoadingStateLoading = isLoadingStateLoading;
|
|
5851
|
+
exports.isLoadingStateWithDefinedValue = isLoadingStateWithDefinedValue;
|
|
5852
|
+
exports.isLoadingStateWithError = isLoadingStateWithError;
|
|
5853
|
+
exports.isLoadingStateWithStateType = isLoadingStateWithStateType;
|
|
5674
5854
|
exports.isNot = isNot;
|
|
5855
|
+
exports.isPageLoadingStateMetadataEqual = isPageLoadingStateMetadataEqual;
|
|
5675
5856
|
exports.isSuccessLoadingState = isSuccessLoadingState;
|
|
5676
5857
|
exports.itemAccumulator = itemAccumulator;
|
|
5677
5858
|
exports.itemAccumulatorNextPageUntilResultsCount = itemAccumulatorNextPageUntilResultsCount;
|
|
@@ -5700,6 +5881,7 @@ exports.mapEachAsync = mapEachAsync;
|
|
|
5700
5881
|
exports.mapFilterWithPreset = mapFilterWithPreset;
|
|
5701
5882
|
exports.mapForEach = mapForEach;
|
|
5702
5883
|
exports.mapIf = mapIf;
|
|
5884
|
+
exports.mapIsListLoadingStateWithEmptyValue = mapIsListLoadingStateWithEmptyValue;
|
|
5703
5885
|
exports.mapItemIteration = mapItemIteration;
|
|
5704
5886
|
exports.mapKeysIntersectionToArray = mapKeysIntersectionToArray;
|
|
5705
5887
|
exports.mapLoadingState = mapLoadingState;
|
|
@@ -5710,6 +5892,9 @@ exports.mapMaybe = mapMaybe;
|
|
|
5710
5892
|
exports.mapMultipleLoadingStateResults = mapMultipleLoadingStateResults;
|
|
5711
5893
|
exports.mapPageItemIteration = mapPageItemIteration;
|
|
5712
5894
|
exports.maybeValueFromObservableOrValueGetter = maybeValueFromObservableOrValueGetter;
|
|
5895
|
+
exports.mergeLoadingStateWithError = mergeLoadingStateWithError;
|
|
5896
|
+
exports.mergeLoadingStateWithLoading = mergeLoadingStateWithLoading;
|
|
5897
|
+
exports.mergeLoadingStateWithValue = mergeLoadingStateWithValue;
|
|
5713
5898
|
exports.mergeLoadingStates = mergeLoadingStates;
|
|
5714
5899
|
exports.multiKeyValueMap = multiKeyValueMap;
|
|
5715
5900
|
exports.onFalseToTrue = onFalseToTrue;
|