@dereekb/rxjs 12.4.4 → 12.5.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 +114 -91
- package/index.esm.js +114 -92
- package/package.json +1 -1
- package/src/lib/iterator/iterator.page.d.ts +1 -1
- package/src/lib/loading/index.d.ts +1 -0
- package/src/lib/loading/loading.context.d.ts +6 -0
- package/src/lib/loading/loading.d.ts +7 -0
- package/src/lib/loading/loading.state.d.ts +13 -0
- package/src/lib/loading/loading.state.rxjs.d.ts +1 -1
- package/src/lib/subscription.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -1979,6 +1979,92 @@ function filterIfObjectValuesUnchanged(input) {
|
|
|
1979
1979
|
}
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
|
+
var classof = classofRaw$2;
|
|
1983
|
+
|
|
1984
|
+
// `IsArray` abstract operation
|
|
1985
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
1986
|
+
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
1987
|
+
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
1988
|
+
return classof(argument) === 'Array';
|
|
1989
|
+
};
|
|
1990
|
+
|
|
1991
|
+
var DESCRIPTORS = descriptors;
|
|
1992
|
+
var isArray = isArray$1;
|
|
1993
|
+
|
|
1994
|
+
var $TypeError$1 = TypeError;
|
|
1995
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1996
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1997
|
+
|
|
1998
|
+
// Safari < 13 does not throw an error in this case
|
|
1999
|
+
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
|
2000
|
+
// makes no sense without proper strict mode support
|
|
2001
|
+
if (this !== undefined) return true;
|
|
2002
|
+
try {
|
|
2003
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2004
|
+
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
|
2005
|
+
} catch (error) {
|
|
2006
|
+
return error instanceof TypeError;
|
|
2007
|
+
}
|
|
2008
|
+
}();
|
|
2009
|
+
|
|
2010
|
+
var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
|
2011
|
+
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
|
2012
|
+
throw new $TypeError$1('Cannot set read only .length');
|
|
2013
|
+
} return O.length = length;
|
|
2014
|
+
} : function (O, length) {
|
|
2015
|
+
return O.length = length;
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
var $TypeError = TypeError;
|
|
2019
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
|
2020
|
+
|
|
2021
|
+
var doesNotExceedSafeInteger$1 = function (it) {
|
|
2022
|
+
if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
|
|
2023
|
+
return it;
|
|
2024
|
+
};
|
|
2025
|
+
|
|
2026
|
+
var $ = _export;
|
|
2027
|
+
var toObject = toObject$3;
|
|
2028
|
+
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
2029
|
+
var setArrayLength = arraySetLength;
|
|
2030
|
+
var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
|
|
2031
|
+
var fails = fails$c;
|
|
2032
|
+
|
|
2033
|
+
var INCORRECT_TO_LENGTH = fails(function () {
|
|
2034
|
+
return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
|
|
2035
|
+
});
|
|
2036
|
+
|
|
2037
|
+
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
|
|
2038
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
|
|
2039
|
+
var properErrorOnNonWritableLength = function () {
|
|
2040
|
+
try {
|
|
2041
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2042
|
+
Object.defineProperty([], 'length', { writable: false }).push();
|
|
2043
|
+
} catch (error) {
|
|
2044
|
+
return error instanceof TypeError;
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
|
|
2048
|
+
var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
|
|
2049
|
+
|
|
2050
|
+
// `Array.prototype.push` method
|
|
2051
|
+
// https://tc39.es/ecma262/#sec-array.prototype.push
|
|
2052
|
+
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
2053
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2054
|
+
push: function push(item) {
|
|
2055
|
+
var O = toObject(this);
|
|
2056
|
+
var len = lengthOfArrayLike(O);
|
|
2057
|
+
var argCount = arguments.length;
|
|
2058
|
+
doesNotExceedSafeInteger(len + argCount);
|
|
2059
|
+
for (var i = 0; i < argCount; i++) {
|
|
2060
|
+
O[len] = arguments[i];
|
|
2061
|
+
len++;
|
|
2062
|
+
}
|
|
2063
|
+
setArrayLength(O, len);
|
|
2064
|
+
return len;
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
|
|
1982
2068
|
/**
|
|
1983
2069
|
* Destroyable object that wraps an Unsubscribable.
|
|
1984
2070
|
*/
|
|
@@ -2031,6 +2117,15 @@ class MultiSubscriptionObject {
|
|
|
2031
2117
|
this.unsub();
|
|
2032
2118
|
this._subscriptions = util.convertToArray(subs);
|
|
2033
2119
|
}
|
|
2120
|
+
addSubs(subs) {
|
|
2121
|
+
const nextSubscriptions = [...(this._subscriptions ?? [])];
|
|
2122
|
+
util.convertToArray(subs).forEach(sub => {
|
|
2123
|
+
if (!nextSubscriptions.includes(sub)) {
|
|
2124
|
+
nextSubscriptions.push(sub);
|
|
2125
|
+
}
|
|
2126
|
+
});
|
|
2127
|
+
this._subscriptions = nextSubscriptions;
|
|
2128
|
+
}
|
|
2034
2129
|
unsub() {
|
|
2035
2130
|
if (this._subscriptions) {
|
|
2036
2131
|
this._subscriptions.forEach(x => x.unsubscribe());
|
|
@@ -2349,92 +2444,6 @@ function iteratorNextPageUntilPage(iteration, page) {
|
|
|
2349
2444
|
});
|
|
2350
2445
|
}
|
|
2351
2446
|
|
|
2352
|
-
var classof = classofRaw$2;
|
|
2353
|
-
|
|
2354
|
-
// `IsArray` abstract operation
|
|
2355
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
2356
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
2357
|
-
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
2358
|
-
return classof(argument) === 'Array';
|
|
2359
|
-
};
|
|
2360
|
-
|
|
2361
|
-
var DESCRIPTORS = descriptors;
|
|
2362
|
-
var isArray = isArray$1;
|
|
2363
|
-
|
|
2364
|
-
var $TypeError$1 = TypeError;
|
|
2365
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
2366
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2367
|
-
|
|
2368
|
-
// Safari < 13 does not throw an error in this case
|
|
2369
|
-
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
|
2370
|
-
// makes no sense without proper strict mode support
|
|
2371
|
-
if (this !== undefined) return true;
|
|
2372
|
-
try {
|
|
2373
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2374
|
-
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
|
2375
|
-
} catch (error) {
|
|
2376
|
-
return error instanceof TypeError;
|
|
2377
|
-
}
|
|
2378
|
-
}();
|
|
2379
|
-
|
|
2380
|
-
var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
|
2381
|
-
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
|
2382
|
-
throw new $TypeError$1('Cannot set read only .length');
|
|
2383
|
-
} return O.length = length;
|
|
2384
|
-
} : function (O, length) {
|
|
2385
|
-
return O.length = length;
|
|
2386
|
-
};
|
|
2387
|
-
|
|
2388
|
-
var $TypeError = TypeError;
|
|
2389
|
-
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
|
2390
|
-
|
|
2391
|
-
var doesNotExceedSafeInteger$1 = function (it) {
|
|
2392
|
-
if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
|
|
2393
|
-
return it;
|
|
2394
|
-
};
|
|
2395
|
-
|
|
2396
|
-
var $ = _export;
|
|
2397
|
-
var toObject = toObject$3;
|
|
2398
|
-
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
2399
|
-
var setArrayLength = arraySetLength;
|
|
2400
|
-
var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
|
|
2401
|
-
var fails = fails$c;
|
|
2402
|
-
|
|
2403
|
-
var INCORRECT_TO_LENGTH = fails(function () {
|
|
2404
|
-
return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
|
|
2405
|
-
});
|
|
2406
|
-
|
|
2407
|
-
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
|
|
2408
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
|
|
2409
|
-
var properErrorOnNonWritableLength = function () {
|
|
2410
|
-
try {
|
|
2411
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2412
|
-
Object.defineProperty([], 'length', { writable: false }).push();
|
|
2413
|
-
} catch (error) {
|
|
2414
|
-
return error instanceof TypeError;
|
|
2415
|
-
}
|
|
2416
|
-
};
|
|
2417
|
-
|
|
2418
|
-
var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
|
|
2419
|
-
|
|
2420
|
-
// `Array.prototype.push` method
|
|
2421
|
-
// https://tc39.es/ecma262/#sec-array.prototype.push
|
|
2422
|
-
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
2423
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2424
|
-
push: function push(item) {
|
|
2425
|
-
var O = toObject(this);
|
|
2426
|
-
var len = lengthOfArrayLike(O);
|
|
2427
|
-
var argCount = arguments.length;
|
|
2428
|
-
doesNotExceedSafeInteger(len + argCount);
|
|
2429
|
-
for (var i = 0; i < argCount; i++) {
|
|
2430
|
-
O[len] = arguments[i];
|
|
2431
|
-
len++;
|
|
2432
|
-
}
|
|
2433
|
-
setArrayLength(O, len);
|
|
2434
|
-
return len;
|
|
2435
|
-
}
|
|
2436
|
-
});
|
|
2437
|
-
|
|
2438
2447
|
function distinctUntilArrayLengthChanges(inputGetArray) {
|
|
2439
2448
|
const getArray = inputGetArray ?? (value => util.asArray(value));
|
|
2440
2449
|
return rxjs.distinctUntilChanged((a, b) => a === b, x => getArray(x).length);
|
|
@@ -3125,6 +3134,16 @@ function switchMapMaybeLoadingContextStream() {
|
|
|
3125
3134
|
return rxjs.switchMap(x => x != null ? x.stream$ : rxjs.of(undefined));
|
|
3126
3135
|
}
|
|
3127
3136
|
|
|
3137
|
+
/**
|
|
3138
|
+
* Returns true if the two LoadingStates are considered equal, by comparing the loading, loadingProgress, error, and value properties.
|
|
3139
|
+
*
|
|
3140
|
+
* @param a LoadingState a
|
|
3141
|
+
* @param b LoadingState b
|
|
3142
|
+
* @returns Returns true if the input LoadingStates are considered equal.
|
|
3143
|
+
*/
|
|
3144
|
+
function isLoadingStateEqual(a, b) {
|
|
3145
|
+
return a.loading === b.loading && a.loadingProgress === b.loadingProgress && a.error === b.error && a.value === b.value;
|
|
3146
|
+
}
|
|
3128
3147
|
/**
|
|
3129
3148
|
* Returns true if the input LoadingErrorPair has the same loading (truthy vs falsy) and error values as the other LoadingErrorPair.
|
|
3130
3149
|
*
|
|
@@ -3133,7 +3152,7 @@ function switchMapMaybeLoadingContextStream() {
|
|
|
3133
3152
|
* @returns Returns true if the input's metadata is considered equivalent.
|
|
3134
3153
|
*/
|
|
3135
3154
|
function isLoadingStateMetadataEqual(a, b) {
|
|
3136
|
-
return a.loading == b.loading && util.valuesAreBothNullishOrEquivalent(a.error, b.error);
|
|
3155
|
+
return a.loading == b.loading && util.valuesAreBothNullishOrEquivalent(a.loadingProgress, b.loadingProgress) && util.valuesAreBothNullishOrEquivalent(a.error, b.error);
|
|
3137
3156
|
}
|
|
3138
3157
|
// MARK: Utility
|
|
3139
3158
|
/**
|
|
@@ -3377,6 +3396,7 @@ function mergeLoadingStates(...args) {
|
|
|
3377
3396
|
const currentLoadings = loadingStates.map(x => x?.error ? x.loading : false);
|
|
3378
3397
|
const nonMaybeLoadings = currentLoadings.filter(x => x != null);
|
|
3379
3398
|
const loading = nonMaybeLoadings.length > 0 ? util.reduceBooleansWithOr(nonMaybeLoadings) : undefined;
|
|
3399
|
+
// TODO: Merge loadingProgress values, probably only if they're all defined though, otherwise undefined
|
|
3380
3400
|
result = {
|
|
3381
3401
|
// Evaluate both for the loading state.
|
|
3382
3402
|
loading,
|
|
@@ -3583,7 +3603,7 @@ function combineLoadingStates(...args) {
|
|
|
3583
3603
|
);
|
|
3584
3604
|
}
|
|
3585
3605
|
/**
|
|
3586
|
-
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes.
|
|
3606
|
+
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes, or the loading state progress.
|
|
3587
3607
|
*
|
|
3588
3608
|
* @param sources
|
|
3589
3609
|
* @returns
|
|
@@ -3603,7 +3623,7 @@ function combineLoadingStatesStatus(sources) {
|
|
|
3603
3623
|
}
|
|
3604
3624
|
}
|
|
3605
3625
|
return result;
|
|
3606
|
-
}), rxjs.distinctUntilChanged((x, y) => loadingStateType(x) === loadingStateType(y)), rxjs.shareReplay(1));
|
|
3626
|
+
}), rxjs.distinctUntilChanged((x, y) => loadingStateType(x) === loadingStateType(y) && x.loadingProgress === y.loadingProgress), rxjs.shareReplay(1));
|
|
3607
3627
|
}
|
|
3608
3628
|
function startWithBeginLoading(state) {
|
|
3609
3629
|
return rxjs.startWith(beginLoading(state));
|
|
@@ -3789,7 +3809,8 @@ const DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = (state, input) => {
|
|
|
3789
3809
|
} = input;
|
|
3790
3810
|
const {
|
|
3791
3811
|
error,
|
|
3792
|
-
value
|
|
3812
|
+
value,
|
|
3813
|
+
loadingProgress
|
|
3793
3814
|
} = state;
|
|
3794
3815
|
let loading = false;
|
|
3795
3816
|
if (!util.hasNonNullValue(error)) {
|
|
@@ -3801,6 +3822,7 @@ const DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = (state, input) => {
|
|
|
3801
3822
|
}
|
|
3802
3823
|
return {
|
|
3803
3824
|
loading,
|
|
3825
|
+
loadingProgress: loading ? loadingProgress : undefined,
|
|
3804
3826
|
error,
|
|
3805
3827
|
value
|
|
3806
3828
|
};
|
|
@@ -3832,7 +3854,7 @@ function loadingStateContext(input) {
|
|
|
3832
3854
|
result = rxjs.of(beginLoading());
|
|
3833
3855
|
}
|
|
3834
3856
|
return result;
|
|
3835
|
-
}), rxjs.distinctUntilChanged(
|
|
3857
|
+
}), rxjs.distinctUntilChanged(isLoadingStateEqual), rxjs.shareReplay(1));
|
|
3836
3858
|
const currentState$ = currentStateStream$.pipe(rxjs.switchMap(x => x ? x : rxjs.of(undefined)));
|
|
3837
3859
|
const state$ = currentState$.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
3838
3860
|
const loading$ = eventStream$.pipe(rxjs.map(isLoadingStateLoading));
|
|
@@ -4970,6 +4992,7 @@ exports.isItemPageIteratorResultEndResult = isItemPageIteratorResultEndResult;
|
|
|
4970
4992
|
exports.isListLoadingStateEmpty = isListLoadingStateEmpty;
|
|
4971
4993
|
exports.isListLoadingStateWithEmptyValue = isListLoadingStateWithEmptyValue;
|
|
4972
4994
|
exports.isLoading = isLoading;
|
|
4995
|
+
exports.isLoadingStateEqual = isLoadingStateEqual;
|
|
4973
4996
|
exports.isLoadingStateFinishedLoading = isLoadingStateFinishedLoading;
|
|
4974
4997
|
exports.isLoadingStateFinishedLoadingWithDefinedValue = isLoadingStateFinishedLoadingWithDefinedValue;
|
|
4975
4998
|
exports.isLoadingStateFinishedLoadingWithError = isLoadingStateFinishedLoadingWithError;
|
package/index.esm.js
CHANGED
|
@@ -1977,6 +1977,92 @@ function filterIfObjectValuesUnchanged(input) {
|
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
1979
|
|
|
1980
|
+
var classof = classofRaw$2;
|
|
1981
|
+
|
|
1982
|
+
// `IsArray` abstract operation
|
|
1983
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
1984
|
+
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
1985
|
+
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
1986
|
+
return classof(argument) === 'Array';
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
var DESCRIPTORS = descriptors;
|
|
1990
|
+
var isArray = isArray$1;
|
|
1991
|
+
|
|
1992
|
+
var $TypeError$1 = TypeError;
|
|
1993
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1994
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1995
|
+
|
|
1996
|
+
// Safari < 13 does not throw an error in this case
|
|
1997
|
+
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
|
1998
|
+
// makes no sense without proper strict mode support
|
|
1999
|
+
if (this !== undefined) return true;
|
|
2000
|
+
try {
|
|
2001
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2002
|
+
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
|
2003
|
+
} catch (error) {
|
|
2004
|
+
return error instanceof TypeError;
|
|
2005
|
+
}
|
|
2006
|
+
}();
|
|
2007
|
+
|
|
2008
|
+
var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
|
2009
|
+
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
|
2010
|
+
throw new $TypeError$1('Cannot set read only .length');
|
|
2011
|
+
} return O.length = length;
|
|
2012
|
+
} : function (O, length) {
|
|
2013
|
+
return O.length = length;
|
|
2014
|
+
};
|
|
2015
|
+
|
|
2016
|
+
var $TypeError = TypeError;
|
|
2017
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
|
2018
|
+
|
|
2019
|
+
var doesNotExceedSafeInteger$1 = function (it) {
|
|
2020
|
+
if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
|
|
2021
|
+
return it;
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2024
|
+
var $ = _export;
|
|
2025
|
+
var toObject = toObject$3;
|
|
2026
|
+
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
2027
|
+
var setArrayLength = arraySetLength;
|
|
2028
|
+
var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
|
|
2029
|
+
var fails = fails$c;
|
|
2030
|
+
|
|
2031
|
+
var INCORRECT_TO_LENGTH = fails(function () {
|
|
2032
|
+
return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
|
|
2033
|
+
});
|
|
2034
|
+
|
|
2035
|
+
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
|
|
2036
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
|
|
2037
|
+
var properErrorOnNonWritableLength = function () {
|
|
2038
|
+
try {
|
|
2039
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2040
|
+
Object.defineProperty([], 'length', { writable: false }).push();
|
|
2041
|
+
} catch (error) {
|
|
2042
|
+
return error instanceof TypeError;
|
|
2043
|
+
}
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
|
|
2047
|
+
|
|
2048
|
+
// `Array.prototype.push` method
|
|
2049
|
+
// https://tc39.es/ecma262/#sec-array.prototype.push
|
|
2050
|
+
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
2051
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2052
|
+
push: function push(item) {
|
|
2053
|
+
var O = toObject(this);
|
|
2054
|
+
var len = lengthOfArrayLike(O);
|
|
2055
|
+
var argCount = arguments.length;
|
|
2056
|
+
doesNotExceedSafeInteger(len + argCount);
|
|
2057
|
+
for (var i = 0; i < argCount; i++) {
|
|
2058
|
+
O[len] = arguments[i];
|
|
2059
|
+
len++;
|
|
2060
|
+
}
|
|
2061
|
+
setArrayLength(O, len);
|
|
2062
|
+
return len;
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
|
|
1980
2066
|
/**
|
|
1981
2067
|
* Destroyable object that wraps an Unsubscribable.
|
|
1982
2068
|
*/
|
|
@@ -2029,6 +2115,15 @@ class MultiSubscriptionObject {
|
|
|
2029
2115
|
this.unsub();
|
|
2030
2116
|
this._subscriptions = convertToArray(subs);
|
|
2031
2117
|
}
|
|
2118
|
+
addSubs(subs) {
|
|
2119
|
+
const nextSubscriptions = [...(this._subscriptions ?? [])];
|
|
2120
|
+
convertToArray(subs).forEach(sub => {
|
|
2121
|
+
if (!nextSubscriptions.includes(sub)) {
|
|
2122
|
+
nextSubscriptions.push(sub);
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2125
|
+
this._subscriptions = nextSubscriptions;
|
|
2126
|
+
}
|
|
2032
2127
|
unsub() {
|
|
2033
2128
|
if (this._subscriptions) {
|
|
2034
2129
|
this._subscriptions.forEach(x => x.unsubscribe());
|
|
@@ -2347,92 +2442,6 @@ function iteratorNextPageUntilPage(iteration, page) {
|
|
|
2347
2442
|
});
|
|
2348
2443
|
}
|
|
2349
2444
|
|
|
2350
|
-
var classof = classofRaw$2;
|
|
2351
|
-
|
|
2352
|
-
// `IsArray` abstract operation
|
|
2353
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
2354
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
2355
|
-
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
2356
|
-
return classof(argument) === 'Array';
|
|
2357
|
-
};
|
|
2358
|
-
|
|
2359
|
-
var DESCRIPTORS = descriptors;
|
|
2360
|
-
var isArray = isArray$1;
|
|
2361
|
-
|
|
2362
|
-
var $TypeError$1 = TypeError;
|
|
2363
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
2364
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2365
|
-
|
|
2366
|
-
// Safari < 13 does not throw an error in this case
|
|
2367
|
-
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
|
2368
|
-
// makes no sense without proper strict mode support
|
|
2369
|
-
if (this !== undefined) return true;
|
|
2370
|
-
try {
|
|
2371
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2372
|
-
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
|
2373
|
-
} catch (error) {
|
|
2374
|
-
return error instanceof TypeError;
|
|
2375
|
-
}
|
|
2376
|
-
}();
|
|
2377
|
-
|
|
2378
|
-
var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
|
2379
|
-
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
|
2380
|
-
throw new $TypeError$1('Cannot set read only .length');
|
|
2381
|
-
} return O.length = length;
|
|
2382
|
-
} : function (O, length) {
|
|
2383
|
-
return O.length = length;
|
|
2384
|
-
};
|
|
2385
|
-
|
|
2386
|
-
var $TypeError = TypeError;
|
|
2387
|
-
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
|
2388
|
-
|
|
2389
|
-
var doesNotExceedSafeInteger$1 = function (it) {
|
|
2390
|
-
if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
|
|
2391
|
-
return it;
|
|
2392
|
-
};
|
|
2393
|
-
|
|
2394
|
-
var $ = _export;
|
|
2395
|
-
var toObject = toObject$3;
|
|
2396
|
-
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
2397
|
-
var setArrayLength = arraySetLength;
|
|
2398
|
-
var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
|
|
2399
|
-
var fails = fails$c;
|
|
2400
|
-
|
|
2401
|
-
var INCORRECT_TO_LENGTH = fails(function () {
|
|
2402
|
-
return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
|
|
2403
|
-
});
|
|
2404
|
-
|
|
2405
|
-
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
|
|
2406
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
|
|
2407
|
-
var properErrorOnNonWritableLength = function () {
|
|
2408
|
-
try {
|
|
2409
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
2410
|
-
Object.defineProperty([], 'length', { writable: false }).push();
|
|
2411
|
-
} catch (error) {
|
|
2412
|
-
return error instanceof TypeError;
|
|
2413
|
-
}
|
|
2414
|
-
};
|
|
2415
|
-
|
|
2416
|
-
var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
|
|
2417
|
-
|
|
2418
|
-
// `Array.prototype.push` method
|
|
2419
|
-
// https://tc39.es/ecma262/#sec-array.prototype.push
|
|
2420
|
-
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
2421
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2422
|
-
push: function push(item) {
|
|
2423
|
-
var O = toObject(this);
|
|
2424
|
-
var len = lengthOfArrayLike(O);
|
|
2425
|
-
var argCount = arguments.length;
|
|
2426
|
-
doesNotExceedSafeInteger(len + argCount);
|
|
2427
|
-
for (var i = 0; i < argCount; i++) {
|
|
2428
|
-
O[len] = arguments[i];
|
|
2429
|
-
len++;
|
|
2430
|
-
}
|
|
2431
|
-
setArrayLength(O, len);
|
|
2432
|
-
return len;
|
|
2433
|
-
}
|
|
2434
|
-
});
|
|
2435
|
-
|
|
2436
2445
|
function distinctUntilArrayLengthChanges(inputGetArray) {
|
|
2437
2446
|
const getArray = inputGetArray ?? (value => asArray(value));
|
|
2438
2447
|
return distinctUntilChanged((a, b) => a === b, x => getArray(x).length);
|
|
@@ -3123,6 +3132,16 @@ function switchMapMaybeLoadingContextStream() {
|
|
|
3123
3132
|
return switchMap(x => x != null ? x.stream$ : of(undefined));
|
|
3124
3133
|
}
|
|
3125
3134
|
|
|
3135
|
+
/**
|
|
3136
|
+
* Returns true if the two LoadingStates are considered equal, by comparing the loading, loadingProgress, error, and value properties.
|
|
3137
|
+
*
|
|
3138
|
+
* @param a LoadingState a
|
|
3139
|
+
* @param b LoadingState b
|
|
3140
|
+
* @returns Returns true if the input LoadingStates are considered equal.
|
|
3141
|
+
*/
|
|
3142
|
+
function isLoadingStateEqual(a, b) {
|
|
3143
|
+
return a.loading === b.loading && a.loadingProgress === b.loadingProgress && a.error === b.error && a.value === b.value;
|
|
3144
|
+
}
|
|
3126
3145
|
/**
|
|
3127
3146
|
* Returns true if the input LoadingErrorPair has the same loading (truthy vs falsy) and error values as the other LoadingErrorPair.
|
|
3128
3147
|
*
|
|
@@ -3131,7 +3150,7 @@ function switchMapMaybeLoadingContextStream() {
|
|
|
3131
3150
|
* @returns Returns true if the input's metadata is considered equivalent.
|
|
3132
3151
|
*/
|
|
3133
3152
|
function isLoadingStateMetadataEqual(a, b) {
|
|
3134
|
-
return a.loading == b.loading && valuesAreBothNullishOrEquivalent(a.error, b.error);
|
|
3153
|
+
return a.loading == b.loading && valuesAreBothNullishOrEquivalent(a.loadingProgress, b.loadingProgress) && valuesAreBothNullishOrEquivalent(a.error, b.error);
|
|
3135
3154
|
}
|
|
3136
3155
|
// MARK: Utility
|
|
3137
3156
|
/**
|
|
@@ -3375,6 +3394,7 @@ function mergeLoadingStates(...args) {
|
|
|
3375
3394
|
const currentLoadings = loadingStates.map(x => x?.error ? x.loading : false);
|
|
3376
3395
|
const nonMaybeLoadings = currentLoadings.filter(x => x != null);
|
|
3377
3396
|
const loading = nonMaybeLoadings.length > 0 ? reduceBooleansWithOr(nonMaybeLoadings) : undefined;
|
|
3397
|
+
// TODO: Merge loadingProgress values, probably only if they're all defined though, otherwise undefined
|
|
3378
3398
|
result = {
|
|
3379
3399
|
// Evaluate both for the loading state.
|
|
3380
3400
|
loading,
|
|
@@ -3581,7 +3601,7 @@ function combineLoadingStates(...args) {
|
|
|
3581
3601
|
);
|
|
3582
3602
|
}
|
|
3583
3603
|
/**
|
|
3584
|
-
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes.
|
|
3604
|
+
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes, or the loading state progress.
|
|
3585
3605
|
*
|
|
3586
3606
|
* @param sources
|
|
3587
3607
|
* @returns
|
|
@@ -3601,7 +3621,7 @@ function combineLoadingStatesStatus(sources) {
|
|
|
3601
3621
|
}
|
|
3602
3622
|
}
|
|
3603
3623
|
return result;
|
|
3604
|
-
}), distinctUntilChanged((x, y) => loadingStateType(x) === loadingStateType(y)), shareReplay(1));
|
|
3624
|
+
}), distinctUntilChanged((x, y) => loadingStateType(x) === loadingStateType(y) && x.loadingProgress === y.loadingProgress), shareReplay(1));
|
|
3605
3625
|
}
|
|
3606
3626
|
function startWithBeginLoading(state) {
|
|
3607
3627
|
return startWith(beginLoading(state));
|
|
@@ -3787,7 +3807,8 @@ const DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = (state, input) => {
|
|
|
3787
3807
|
} = input;
|
|
3788
3808
|
const {
|
|
3789
3809
|
error,
|
|
3790
|
-
value
|
|
3810
|
+
value,
|
|
3811
|
+
loadingProgress
|
|
3791
3812
|
} = state;
|
|
3792
3813
|
let loading = false;
|
|
3793
3814
|
if (!hasNonNullValue(error)) {
|
|
@@ -3799,6 +3820,7 @@ const DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = (state, input) => {
|
|
|
3799
3820
|
}
|
|
3800
3821
|
return {
|
|
3801
3822
|
loading,
|
|
3823
|
+
loadingProgress: loading ? loadingProgress : undefined,
|
|
3802
3824
|
error,
|
|
3803
3825
|
value
|
|
3804
3826
|
};
|
|
@@ -3830,7 +3852,7 @@ function loadingStateContext(input) {
|
|
|
3830
3852
|
result = of(beginLoading());
|
|
3831
3853
|
}
|
|
3832
3854
|
return result;
|
|
3833
|
-
}), distinctUntilChanged(
|
|
3855
|
+
}), distinctUntilChanged(isLoadingStateEqual), shareReplay(1));
|
|
3834
3856
|
const currentState$ = currentStateStream$.pipe(switchMap(x => x ? x : of(undefined)));
|
|
3835
3857
|
const state$ = currentState$.pipe(filterMaybe(), shareReplay(1));
|
|
3836
3858
|
const loading$ = eventStream$.pipe(map$1(isLoadingStateLoading));
|
|
@@ -4891,4 +4913,4 @@ function workFactoryForConfigFactory(configFactory) {
|
|
|
4891
4913
|
};
|
|
4892
4914
|
}
|
|
4893
4915
|
|
|
4894
|
-
export { DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, LoadingStateType, LockSet, MultiSubscriptionObject, PresetFilterSource, SimpleLoadingContext, SubscriptionObject, ValuesLoadingContext, WorkInstance, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState, allLoadingStatesHaveFinishedLoading, areAllLoadingStatesFinishedLoading, arrayValueFromFinishedLoadingState, asObservable, asObservableFromGetter, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, catchLoadingStateErrorWithOperator, checkIs, cleanup, cleanupDestroyable, combineLatestFromArrayObsFn, combineLatestFromMapValuesObsFn, combineLatestFromObject, combineLatestMapFrom, combineLoadingStates, combineLoadingStatesStatus, currentValueFromLoadingState, distinctLoadingState, distinctUntilArrayLengthChanges, distinctUntilHasDifferentValues, distinctUntilItemsHaveDifferentValues, distinctUntilItemsValueChanges, distinctUntilKeysChange, distinctUntilMapHasDifferentKeys, distinctUntilModelIdChange, distinctUntilModelKeyChange, distinctUntilObjectKeyChange, distinctUntilObjectValuesChanged, emitAfterDelay, emitDelayObs, errorFromLoadingState, errorOnEmissionsInPeriod, errorPageResult, errorResult, factoryTimer, filterIfObjectValuesUnchanged, filterItemsWithObservableDecision, filterMaybe, filterMaybeArray, filterMaybeStrict, filterUnique, filterWithSearchString, flattenAccumulatorResultItemArray, idleLoadingState, incrementingNumberTimer, initialize, invertObservableDecision, isAnyLoadingStateInLoadingState, isErrorLoadingState, isItemPageIteratorResultEndResult, isListLoadingStateEmpty, isListLoadingStateWithEmptyValue, isLoading, isLoadingStateFinishedLoading, isLoadingStateFinishedLoadingWithDefinedValue, isLoadingStateFinishedLoadingWithError, isLoadingStateInErrorState, isLoadingStateInIdleState, isLoadingStateInLoadingState, isLoadingStateInSuccessState, isLoadingStateLoading, isLoadingStateMetadataEqual, isLoadingStateWithDefinedValue, isLoadingStateWithError, isLoadingStateWithStateType, isNot, isPageLoadingStateMetadataEqual, isSuccessLoadingState, itemAccumulator, itemAccumulatorNextPageUntilResultsCount, iterationHasNextAndCanLoadMore, iteratorNextPageUntilMaxPageLoadLimit, iteratorNextPageUntilPage, keyValueMap, lazyFrom, listLoadingStateContext, listLoadingStateIsEmpty, loadingStateContext, loadingStateFromObs, loadingStateHasError, loadingStateHasFinishedLoading, loadingStateHasFinishedLoadingWithError, loadingStateHasFinishedLoadingWithValue, loadingStateHasValue, loadingStateIsIdle, loadingStateIsLoading, loadingStateType, loadingStatesHaveEquivalentMetadata, makeCheckIsFunction, makeIsModifiedFunction, makeIsModifiedFunctionObservable, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mapMultipleLoadingStateResults, mapPageItemIteration, mappedPageItemIteration, maybeValueFromObservableOrValue, maybeValueFromObservableOrValueGetter, mergeLoadingStateWithError, mergeLoadingStateWithLoading, mergeLoadingStateWithValue, mergeLoadingStates, multiKeyValueMap, onFalseToTrue, onLockSetNextUnlock, onMatchDelta, onTrueToFalse, pageItemAccumulatorCurrentPage, pageLoadingStateFromObs, pipeIf, preventComplete, promiseFromLoadingState, randomDelay, randomDelayWithRandomFunction, returnIfIs, scanBuildArray, scanCount, scanIntoArray, setContainsAllValuesFrom, setContainsAnyValueFrom, setContainsNoValueFrom, skipAllInitialMaybe, skipFirstMaybe, skipInitialMaybe, skipMaybes, startWithBeginLoading, successPageResult, successResult, switchMapFilterMaybe, switchMapMaybe, switchMapMaybeDefault, switchMapMaybeLoadingContextStream, switchMapMaybeObs, switchMapObject, switchMapOnBoolean, switchMapToDefault, switchMapWhileFalse, switchMapWhileTrue, tapAfterTimeout, tapFirst, tapLog, tapOnLoadingStateSuccess, tapOnLoadingStateType, throwErrorAfterTimeout, timeoutStartWith, unknownLoadingStatesIsLoading, updatedStateForSetError, updatedStateForSetLoading, updatedStateForSetValue, useAsObservable, useFirst, valueFromFinishedLoadingState, valueFromLoadingState, valueFromObservableOrValue, valueFromObservableOrValueGetter, workFactory, workFactoryForConfigFactory };
|
|
4916
|
+
export { DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, LoadingStateType, LockSet, MultiSubscriptionObject, PresetFilterSource, SimpleLoadingContext, SubscriptionObject, ValuesLoadingContext, WorkInstance, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState, allLoadingStatesHaveFinishedLoading, areAllLoadingStatesFinishedLoading, arrayValueFromFinishedLoadingState, asObservable, asObservableFromGetter, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, catchLoadingStateErrorWithOperator, checkIs, cleanup, cleanupDestroyable, combineLatestFromArrayObsFn, combineLatestFromMapValuesObsFn, combineLatestFromObject, combineLatestMapFrom, combineLoadingStates, combineLoadingStatesStatus, currentValueFromLoadingState, distinctLoadingState, distinctUntilArrayLengthChanges, distinctUntilHasDifferentValues, distinctUntilItemsHaveDifferentValues, distinctUntilItemsValueChanges, distinctUntilKeysChange, distinctUntilMapHasDifferentKeys, distinctUntilModelIdChange, distinctUntilModelKeyChange, distinctUntilObjectKeyChange, distinctUntilObjectValuesChanged, emitAfterDelay, emitDelayObs, errorFromLoadingState, errorOnEmissionsInPeriod, errorPageResult, errorResult, factoryTimer, filterIfObjectValuesUnchanged, filterItemsWithObservableDecision, filterMaybe, filterMaybeArray, filterMaybeStrict, filterUnique, filterWithSearchString, flattenAccumulatorResultItemArray, idleLoadingState, incrementingNumberTimer, initialize, invertObservableDecision, isAnyLoadingStateInLoadingState, isErrorLoadingState, isItemPageIteratorResultEndResult, isListLoadingStateEmpty, isListLoadingStateWithEmptyValue, isLoading, isLoadingStateEqual, isLoadingStateFinishedLoading, isLoadingStateFinishedLoadingWithDefinedValue, isLoadingStateFinishedLoadingWithError, isLoadingStateInErrorState, isLoadingStateInIdleState, isLoadingStateInLoadingState, isLoadingStateInSuccessState, isLoadingStateLoading, isLoadingStateMetadataEqual, isLoadingStateWithDefinedValue, isLoadingStateWithError, isLoadingStateWithStateType, isNot, isPageLoadingStateMetadataEqual, isSuccessLoadingState, itemAccumulator, itemAccumulatorNextPageUntilResultsCount, iterationHasNextAndCanLoadMore, iteratorNextPageUntilMaxPageLoadLimit, iteratorNextPageUntilPage, keyValueMap, lazyFrom, listLoadingStateContext, listLoadingStateIsEmpty, loadingStateContext, loadingStateFromObs, loadingStateHasError, loadingStateHasFinishedLoading, loadingStateHasFinishedLoadingWithError, loadingStateHasFinishedLoadingWithValue, loadingStateHasValue, loadingStateIsIdle, loadingStateIsLoading, loadingStateType, loadingStatesHaveEquivalentMetadata, makeCheckIsFunction, makeIsModifiedFunction, makeIsModifiedFunctionObservable, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mapMultipleLoadingStateResults, mapPageItemIteration, mappedPageItemIteration, maybeValueFromObservableOrValue, maybeValueFromObservableOrValueGetter, mergeLoadingStateWithError, mergeLoadingStateWithLoading, mergeLoadingStateWithValue, mergeLoadingStates, multiKeyValueMap, onFalseToTrue, onLockSetNextUnlock, onMatchDelta, onTrueToFalse, pageItemAccumulatorCurrentPage, pageLoadingStateFromObs, pipeIf, preventComplete, promiseFromLoadingState, randomDelay, randomDelayWithRandomFunction, returnIfIs, scanBuildArray, scanCount, scanIntoArray, setContainsAllValuesFrom, setContainsAnyValueFrom, setContainsNoValueFrom, skipAllInitialMaybe, skipFirstMaybe, skipInitialMaybe, skipMaybes, startWithBeginLoading, successPageResult, successResult, switchMapFilterMaybe, switchMapMaybe, switchMapMaybeDefault, switchMapMaybeLoadingContextStream, switchMapMaybeObs, switchMapObject, switchMapOnBoolean, switchMapToDefault, switchMapWhileFalse, switchMapWhileTrue, tapAfterTimeout, tapFirst, tapLog, tapOnLoadingStateSuccess, tapOnLoadingStateType, throwErrorAfterTimeout, timeoutStartWith, unknownLoadingStatesIsLoading, updatedStateForSetError, updatedStateForSetLoading, updatedStateForSetValue, useAsObservable, useFirst, valueFromFinishedLoadingState, valueFromLoadingState, valueFromObservableOrValue, valueFromObservableOrValueGetter, workFactory, workFactoryForConfigFactory };
|
package/package.json
CHANGED
|
@@ -62,7 +62,7 @@ export interface ItemPageIteratorDelegate<V, F, C extends ItemPageIterationConfi
|
|
|
62
62
|
*
|
|
63
63
|
* If the input goes out of bounds, the result should be an empty array.
|
|
64
64
|
*/
|
|
65
|
-
loadItemsForPage
|
|
65
|
+
loadItemsForPage(request: ItemPageIteratorRequest<V, F, C>): Observable<ItemPageIteratorResult<V>>;
|
|
66
66
|
}
|
|
67
67
|
export interface ItemPageIterationConfig<F = unknown> extends Filter<F>, ItemPageLimit {
|
|
68
68
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { type Observable } from 'rxjs';
|
|
2
2
|
import { type LoadingState, type LoadingErrorPair } from './loading.state';
|
|
3
|
+
import { LoadingProgress } from './loading';
|
|
4
|
+
import { Maybe } from '@dereekb/util';
|
|
3
5
|
/**
|
|
4
6
|
* A LoadingErrorPair that always defines a loading value.
|
|
5
7
|
*/
|
|
6
8
|
export interface LoadingContextEvent extends LoadingErrorPair {
|
|
7
9
|
readonly loading: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Optional loading progress value.
|
|
12
|
+
*/
|
|
13
|
+
readonly loadingProgress?: Maybe<LoadingProgress>;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
16
|
* An observable LoadingContext that provides a stream of LoadingContextEvents.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Maybe, type ReadableError, type ReadableDataError, type Page, type FilteredPage, type PageNumber, type MapFunction, type ErrorInput } from '@dereekb/util';
|
|
2
|
+
import { type LoadingProgress } from './loading';
|
|
2
3
|
/**
|
|
3
4
|
* A value/error pair used in loading situations.
|
|
4
5
|
*/
|
|
@@ -9,11 +10,23 @@ export interface LoadingErrorPair {
|
|
|
9
10
|
* Not being specified is considered not being loaded.
|
|
10
11
|
*/
|
|
11
12
|
readonly loading?: Maybe<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional loading progress value.
|
|
15
|
+
*/
|
|
16
|
+
readonly loadingProgress?: Maybe<LoadingProgress>;
|
|
12
17
|
/**
|
|
13
18
|
* A Readable server error.
|
|
14
19
|
*/
|
|
15
20
|
readonly error?: Maybe<ReadableError>;
|
|
16
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns true if the two LoadingStates are considered equal, by comparing the loading, loadingProgress, error, and value properties.
|
|
24
|
+
*
|
|
25
|
+
* @param a LoadingState a
|
|
26
|
+
* @param b LoadingState b
|
|
27
|
+
* @returns Returns true if the input LoadingStates are considered equal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isLoadingStateEqual<T extends LoadingState>(a: T, b: T): boolean;
|
|
17
30
|
/**
|
|
18
31
|
* Returns true if the input LoadingErrorPair has the same loading (truthy vs falsy) and error values as the other LoadingErrorPair.
|
|
19
32
|
*
|
|
@@ -20,7 +20,7 @@ export declare function combineLoadingStates<A extends object, B extends object,
|
|
|
20
20
|
export declare function combineLoadingStates<A extends object, B extends object, C extends object, D extends object, E extends object, O>(obsA: Observable<LoadingState<A>>, obsB: Observable<LoadingState<B>>, obsC: Observable<LoadingState<C>>, obsD: Observable<LoadingState<D>>, obsE: Observable<LoadingState<E>>, mergeFn: (a: A, b: B, c: C, d: D, e: E) => O): Observable<LoadingState<O>>;
|
|
21
21
|
export declare function combineLoadingStates<O>(...args: any[]): Observable<LoadingState<O>>;
|
|
22
22
|
/**
|
|
23
|
-
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes.
|
|
23
|
+
* Combines the status of all loading states. Only emits when the LoadingStateType of the result changes, or the loading state progress.
|
|
24
24
|
*
|
|
25
25
|
* @param sources
|
|
26
26
|
* @returns
|
|
@@ -23,6 +23,7 @@ export declare class MultiSubscriptionObject<T extends Unsubscribable = Unsubscr
|
|
|
23
23
|
get hasSubscription(): boolean;
|
|
24
24
|
set subscriptions(subs: ArrayOrValue<T>);
|
|
25
25
|
setSubs(subs: ArrayOrValue<T>): void;
|
|
26
|
+
addSubs(subs: ArrayOrValue<T>): void;
|
|
26
27
|
unsub(): void;
|
|
27
28
|
destroy(): void;
|
|
28
29
|
}
|