@dereekb/rxjs 12.0.4 → 12.0.6
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
CHANGED
|
@@ -2143,6 +2143,10 @@ function checkIs(isCheckFunction, value, defaultValueOnMaybe = false) {
|
|
|
2143
2143
|
function filterMaybe() {
|
|
2144
2144
|
return rxjs.filter(util.isMaybeSo);
|
|
2145
2145
|
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Equivalent to filterMaybe, but returns a strict MaybeSoStrict<T> value instead of the template type.
|
|
2148
|
+
*/
|
|
2149
|
+
const filterMaybeStrict = filterMaybe;
|
|
2146
2150
|
/**
|
|
2147
2151
|
* Observable filter that filters maybe value from the input array of maybe values
|
|
2148
2152
|
*/
|
|
@@ -2152,9 +2156,21 @@ function filterMaybeArray() {
|
|
|
2152
2156
|
/**
|
|
2153
2157
|
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2154
2158
|
*/
|
|
2155
|
-
function
|
|
2159
|
+
function skipAllInitialMaybe() {
|
|
2156
2160
|
return rxjs.skipWhile(x => x == null);
|
|
2157
2161
|
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Skips only the first maybe value, then returns all values afterwards.
|
|
2164
|
+
*/
|
|
2165
|
+
function skipInitialMaybe() {
|
|
2166
|
+
return skipMaybes(1);
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Skips up to the given number of maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2170
|
+
*/
|
|
2171
|
+
function skipMaybes(maxToSkip) {
|
|
2172
|
+
return rxjs.skipWhile((x, i) => x == null && i < maxToSkip);
|
|
2173
|
+
}
|
|
2158
2174
|
/**
|
|
2159
2175
|
* Provides a switchMap that will emit the observable if the observable is defined, otherwise will return the default value.
|
|
2160
2176
|
*
|
|
@@ -2283,6 +2299,17 @@ function emitDelayObs(startWith, endWith, delayTime) {
|
|
|
2283
2299
|
function emitAfterDelay(value, delayTime) {
|
|
2284
2300
|
return obs => obs.pipe(rxjs.switchMap(x => rxjs.of(value).pipe(rxjs.delay(delayTime), rxjs.startWith(x))));
|
|
2285
2301
|
}
|
|
2302
|
+
// MARK: Compat
|
|
2303
|
+
/**
|
|
2304
|
+
* @deprecated use switchMapFilterMaybe instead.
|
|
2305
|
+
*/
|
|
2306
|
+
const switchMapMaybeObs = switchMapFilterMaybe;
|
|
2307
|
+
/**
|
|
2308
|
+
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2309
|
+
*
|
|
2310
|
+
* @deprecated use skipAllInitialMaybe instead.
|
|
2311
|
+
*/
|
|
2312
|
+
const skipFirstMaybe = skipAllInitialMaybe;
|
|
2286
2313
|
|
|
2287
2314
|
/**
|
|
2288
2315
|
* Equivalent to distinctUntilChanged() using areEqualPOJOValues().
|
|
@@ -5147,13 +5174,23 @@ function startWithBeginLoading(state) {
|
|
|
5147
5174
|
return rxjs.startWith(beginLoading(state));
|
|
5148
5175
|
}
|
|
5149
5176
|
/**
|
|
5150
|
-
* Returns the value
|
|
5177
|
+
* Returns the current value from the LoadingState.
|
|
5151
5178
|
*/
|
|
5152
|
-
function
|
|
5179
|
+
function currentValueFromLoadingState() {
|
|
5153
5180
|
return obs => {
|
|
5154
5181
|
return obs.pipe(rxjs.map(x => x.value));
|
|
5155
5182
|
};
|
|
5156
5183
|
}
|
|
5184
|
+
/**
|
|
5185
|
+
* Returns the current non-null value from the LoadingState.
|
|
5186
|
+
*
|
|
5187
|
+
* Equivalent to currentValueFromLoadingState() and filterMaybe().
|
|
5188
|
+
*/
|
|
5189
|
+
function valueFromLoadingState() {
|
|
5190
|
+
return obs => {
|
|
5191
|
+
return obs.pipe(rxjs.map(x => x.value), filterMaybeStrict());
|
|
5192
|
+
};
|
|
5193
|
+
}
|
|
5157
5194
|
/**
|
|
5158
5195
|
* Returns the error once the LoadingState has finished loading with an error.
|
|
5159
5196
|
*/
|
|
@@ -5162,12 +5199,12 @@ function errorFromLoadingState() {
|
|
|
5162
5199
|
return obs.pipe(rxjs.filter(isLoadingStateWithError), rxjs.map(x => x.error));
|
|
5163
5200
|
};
|
|
5164
5201
|
}
|
|
5165
|
-
|
|
5166
|
-
* Returns the value once the LoadingState has finished loading, even if an error occured or there is no value.
|
|
5167
|
-
*/
|
|
5168
|
-
function valueFromFinishedLoadingState() {
|
|
5202
|
+
function valueFromFinishedLoadingState(defaultValue) {
|
|
5169
5203
|
return obs => {
|
|
5170
|
-
return obs.pipe(rxjs.filter(isLoadingStateFinishedLoading), rxjs.map(x =>
|
|
5204
|
+
return obs.pipe(rxjs.filter(isLoadingStateFinishedLoading), rxjs.map(x => {
|
|
5205
|
+
var _x$value;
|
|
5206
|
+
return (_x$value = x.value) != null ? _x$value : util.getValueFromGetter(defaultValue);
|
|
5207
|
+
}));
|
|
5171
5208
|
};
|
|
5172
5209
|
}
|
|
5173
5210
|
function tapOnLoadingStateType(fn, type) {
|
|
@@ -5361,7 +5398,7 @@ function loadingStateContext(input) {
|
|
|
5361
5398
|
const currentState$ = currentStateStream$.pipe(rxjs.switchMap(x => x ? x : rxjs.of(undefined)));
|
|
5362
5399
|
const state$ = currentState$.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
5363
5400
|
const loading$ = eventStream$.pipe(rxjs.map(isLoadingStateLoading));
|
|
5364
|
-
const currentValue$ = state$.pipe(
|
|
5401
|
+
const currentValue$ = state$.pipe(currentValueFromLoadingState(), rxjs.shareReplay(1));
|
|
5365
5402
|
const valueAfterLoaded$ = state$.pipe(valueFromFinishedLoadingState(), rxjs.shareReplay(1));
|
|
5366
5403
|
const value$ = valueAfterLoaded$.pipe(filterMaybe(), rxjs.shareReplay(1));
|
|
5367
5404
|
function setStateObs(obs) {
|
|
@@ -5412,6 +5449,18 @@ function pageLoadingStateFromObs(obs, firstOnly, page = 0) {
|
|
|
5412
5449
|
return x;
|
|
5413
5450
|
}));
|
|
5414
5451
|
}
|
|
5452
|
+
/**
|
|
5453
|
+
* Returns the value once the LoadingState has finished loading, even if an error occured.
|
|
5454
|
+
*
|
|
5455
|
+
* The value is defaulted to an empty array.
|
|
5456
|
+
*
|
|
5457
|
+
* @returns Observable of the value
|
|
5458
|
+
*/
|
|
5459
|
+
function arrayValueFromFinishedLoadingState() {
|
|
5460
|
+
return obs => {
|
|
5461
|
+
return obs.pipe(valueFromFinishedLoadingState(() => []));
|
|
5462
|
+
};
|
|
5463
|
+
}
|
|
5415
5464
|
// MARK: Compat
|
|
5416
5465
|
/**
|
|
5417
5466
|
* @deprecated use isListLoadingStateWithEmptyValue instead.
|
|
@@ -6408,6 +6457,7 @@ exports.accumulatorCurrentPageListLoadingState = accumulatorCurrentPageListLoadi
|
|
|
6408
6457
|
exports.accumulatorFlattenPageListLoadingState = accumulatorFlattenPageListLoadingState;
|
|
6409
6458
|
exports.allLoadingStatesHaveFinishedLoading = allLoadingStatesHaveFinishedLoading;
|
|
6410
6459
|
exports.areAllLoadingStatesFinishedLoading = areAllLoadingStatesFinishedLoading;
|
|
6460
|
+
exports.arrayValueFromFinishedLoadingState = arrayValueFromFinishedLoadingState;
|
|
6411
6461
|
exports.asObservable = asObservable;
|
|
6412
6462
|
exports.asObservableFromGetter = asObservableFromGetter;
|
|
6413
6463
|
exports.asyncPusher = asyncPusher;
|
|
@@ -6424,6 +6474,7 @@ exports.combineLatestFromObject = combineLatestFromObject;
|
|
|
6424
6474
|
exports.combineLatestMapFrom = combineLatestMapFrom;
|
|
6425
6475
|
exports.combineLoadingStates = combineLoadingStates;
|
|
6426
6476
|
exports.combineLoadingStatesStatus = combineLoadingStatesStatus;
|
|
6477
|
+
exports.currentValueFromLoadingState = currentValueFromLoadingState;
|
|
6427
6478
|
exports.distinctLoadingState = distinctLoadingState;
|
|
6428
6479
|
exports.distinctUntilArrayLengthChanges = distinctUntilArrayLengthChanges;
|
|
6429
6480
|
exports.distinctUntilHasDifferentValues = distinctUntilHasDifferentValues;
|
|
@@ -6446,6 +6497,7 @@ exports.filterIfObjectValuesUnchanged = filterIfObjectValuesUnchanged;
|
|
|
6446
6497
|
exports.filterItemsWithObservableDecision = filterItemsWithObservableDecision;
|
|
6447
6498
|
exports.filterMaybe = filterMaybe;
|
|
6448
6499
|
exports.filterMaybeArray = filterMaybeArray;
|
|
6500
|
+
exports.filterMaybeStrict = filterMaybeStrict;
|
|
6449
6501
|
exports.filterUnique = filterUnique;
|
|
6450
6502
|
exports.filterWithSearchString = filterWithSearchString;
|
|
6451
6503
|
exports.flattenAccumulatorResultItemArray = flattenAccumulatorResultItemArray;
|
|
@@ -6539,7 +6591,10 @@ exports.scanIntoArray = scanIntoArray;
|
|
|
6539
6591
|
exports.setContainsAllValuesFrom = setContainsAllValuesFrom;
|
|
6540
6592
|
exports.setContainsAnyValueFrom = setContainsAnyValueFrom;
|
|
6541
6593
|
exports.setContainsNoValueFrom = setContainsNoValueFrom;
|
|
6594
|
+
exports.skipAllInitialMaybe = skipAllInitialMaybe;
|
|
6542
6595
|
exports.skipFirstMaybe = skipFirstMaybe;
|
|
6596
|
+
exports.skipInitialMaybe = skipInitialMaybe;
|
|
6597
|
+
exports.skipMaybes = skipMaybes;
|
|
6543
6598
|
exports.startWithBeginLoading = startWithBeginLoading;
|
|
6544
6599
|
exports.successPageResult = successPageResult;
|
|
6545
6600
|
exports.successResult = successResult;
|
|
@@ -6547,6 +6602,7 @@ exports.switchMapFilterMaybe = switchMapFilterMaybe;
|
|
|
6547
6602
|
exports.switchMapMaybe = switchMapMaybe;
|
|
6548
6603
|
exports.switchMapMaybeDefault = switchMapMaybeDefault;
|
|
6549
6604
|
exports.switchMapMaybeLoadingContextStream = switchMapMaybeLoadingContextStream;
|
|
6605
|
+
exports.switchMapMaybeObs = switchMapMaybeObs;
|
|
6550
6606
|
exports.switchMapObject = switchMapObject;
|
|
6551
6607
|
exports.switchMapOnBoolean = switchMapOnBoolean;
|
|
6552
6608
|
exports.switchMapToDefault = switchMapToDefault;
|
package/index.esm.js
CHANGED
|
@@ -2141,6 +2141,10 @@ function checkIs(isCheckFunction, value, defaultValueOnMaybe = false) {
|
|
|
2141
2141
|
function filterMaybe() {
|
|
2142
2142
|
return filter(isMaybeSo);
|
|
2143
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Equivalent to filterMaybe, but returns a strict MaybeSoStrict<T> value instead of the template type.
|
|
2146
|
+
*/
|
|
2147
|
+
const filterMaybeStrict = filterMaybe;
|
|
2144
2148
|
/**
|
|
2145
2149
|
* Observable filter that filters maybe value from the input array of maybe values
|
|
2146
2150
|
*/
|
|
@@ -2150,9 +2154,21 @@ function filterMaybeArray() {
|
|
|
2150
2154
|
/**
|
|
2151
2155
|
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2152
2156
|
*/
|
|
2153
|
-
function
|
|
2157
|
+
function skipAllInitialMaybe() {
|
|
2154
2158
|
return skipWhile(x => x == null);
|
|
2155
2159
|
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Skips only the first maybe value, then returns all values afterwards.
|
|
2162
|
+
*/
|
|
2163
|
+
function skipInitialMaybe() {
|
|
2164
|
+
return skipMaybes(1);
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Skips up to the given number of maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2168
|
+
*/
|
|
2169
|
+
function skipMaybes(maxToSkip) {
|
|
2170
|
+
return skipWhile((x, i) => x == null && i < maxToSkip);
|
|
2171
|
+
}
|
|
2156
2172
|
/**
|
|
2157
2173
|
* Provides a switchMap that will emit the observable if the observable is defined, otherwise will return the default value.
|
|
2158
2174
|
*
|
|
@@ -2281,6 +2297,17 @@ function emitDelayObs(startWith, endWith, delayTime) {
|
|
|
2281
2297
|
function emitAfterDelay(value, delayTime) {
|
|
2282
2298
|
return obs => obs.pipe(switchMap(x => of(value).pipe(delay(delayTime), startWith(x))));
|
|
2283
2299
|
}
|
|
2300
|
+
// MARK: Compat
|
|
2301
|
+
/**
|
|
2302
|
+
* @deprecated use switchMapFilterMaybe instead.
|
|
2303
|
+
*/
|
|
2304
|
+
const switchMapMaybeObs = switchMapFilterMaybe;
|
|
2305
|
+
/**
|
|
2306
|
+
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
2307
|
+
*
|
|
2308
|
+
* @deprecated use skipAllInitialMaybe instead.
|
|
2309
|
+
*/
|
|
2310
|
+
const skipFirstMaybe = skipAllInitialMaybe;
|
|
2284
2311
|
|
|
2285
2312
|
/**
|
|
2286
2313
|
* Equivalent to distinctUntilChanged() using areEqualPOJOValues().
|
|
@@ -5145,13 +5172,23 @@ function startWithBeginLoading(state) {
|
|
|
5145
5172
|
return startWith(beginLoading(state));
|
|
5146
5173
|
}
|
|
5147
5174
|
/**
|
|
5148
|
-
* Returns the value
|
|
5175
|
+
* Returns the current value from the LoadingState.
|
|
5149
5176
|
*/
|
|
5150
|
-
function
|
|
5177
|
+
function currentValueFromLoadingState() {
|
|
5151
5178
|
return obs => {
|
|
5152
5179
|
return obs.pipe(map$1(x => x.value));
|
|
5153
5180
|
};
|
|
5154
5181
|
}
|
|
5182
|
+
/**
|
|
5183
|
+
* Returns the current non-null value from the LoadingState.
|
|
5184
|
+
*
|
|
5185
|
+
* Equivalent to currentValueFromLoadingState() and filterMaybe().
|
|
5186
|
+
*/
|
|
5187
|
+
function valueFromLoadingState() {
|
|
5188
|
+
return obs => {
|
|
5189
|
+
return obs.pipe(map$1(x => x.value), filterMaybeStrict());
|
|
5190
|
+
};
|
|
5191
|
+
}
|
|
5155
5192
|
/**
|
|
5156
5193
|
* Returns the error once the LoadingState has finished loading with an error.
|
|
5157
5194
|
*/
|
|
@@ -5160,12 +5197,12 @@ function errorFromLoadingState() {
|
|
|
5160
5197
|
return obs.pipe(filter(isLoadingStateWithError), map$1(x => x.error));
|
|
5161
5198
|
};
|
|
5162
5199
|
}
|
|
5163
|
-
|
|
5164
|
-
* Returns the value once the LoadingState has finished loading, even if an error occured or there is no value.
|
|
5165
|
-
*/
|
|
5166
|
-
function valueFromFinishedLoadingState() {
|
|
5200
|
+
function valueFromFinishedLoadingState(defaultValue) {
|
|
5167
5201
|
return obs => {
|
|
5168
|
-
return obs.pipe(filter(isLoadingStateFinishedLoading), map$1(x =>
|
|
5202
|
+
return obs.pipe(filter(isLoadingStateFinishedLoading), map$1(x => {
|
|
5203
|
+
var _x$value;
|
|
5204
|
+
return (_x$value = x.value) != null ? _x$value : getValueFromGetter(defaultValue);
|
|
5205
|
+
}));
|
|
5169
5206
|
};
|
|
5170
5207
|
}
|
|
5171
5208
|
function tapOnLoadingStateType(fn, type) {
|
|
@@ -5359,7 +5396,7 @@ function loadingStateContext(input) {
|
|
|
5359
5396
|
const currentState$ = currentStateStream$.pipe(switchMap(x => x ? x : of(undefined)));
|
|
5360
5397
|
const state$ = currentState$.pipe(filterMaybe(), shareReplay(1));
|
|
5361
5398
|
const loading$ = eventStream$.pipe(map$1(isLoadingStateLoading));
|
|
5362
|
-
const currentValue$ = state$.pipe(
|
|
5399
|
+
const currentValue$ = state$.pipe(currentValueFromLoadingState(), shareReplay(1));
|
|
5363
5400
|
const valueAfterLoaded$ = state$.pipe(valueFromFinishedLoadingState(), shareReplay(1));
|
|
5364
5401
|
const value$ = valueAfterLoaded$.pipe(filterMaybe(), shareReplay(1));
|
|
5365
5402
|
function setStateObs(obs) {
|
|
@@ -5410,6 +5447,18 @@ function pageLoadingStateFromObs(obs, firstOnly, page = 0) {
|
|
|
5410
5447
|
return x;
|
|
5411
5448
|
}));
|
|
5412
5449
|
}
|
|
5450
|
+
/**
|
|
5451
|
+
* Returns the value once the LoadingState has finished loading, even if an error occured.
|
|
5452
|
+
*
|
|
5453
|
+
* The value is defaulted to an empty array.
|
|
5454
|
+
*
|
|
5455
|
+
* @returns Observable of the value
|
|
5456
|
+
*/
|
|
5457
|
+
function arrayValueFromFinishedLoadingState() {
|
|
5458
|
+
return obs => {
|
|
5459
|
+
return obs.pipe(valueFromFinishedLoadingState(() => []));
|
|
5460
|
+
};
|
|
5461
|
+
}
|
|
5413
5462
|
// MARK: Compat
|
|
5414
5463
|
/**
|
|
5415
5464
|
* @deprecated use isListLoadingStateWithEmptyValue instead.
|
|
@@ -6383,4 +6432,4 @@ function workFactoryForConfigFactory(configFactory) {
|
|
|
6383
6432
|
};
|
|
6384
6433
|
}
|
|
6385
6434
|
|
|
6386
|
-
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, asObservable, asObservableFromGetter, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, catchLoadingStateErrorWithOperator, checkIs, cleanup, cleanupDestroyable, combineLatestFromArrayObsFn, combineLatestFromMapValuesObsFn, combineLatestFromObject, combineLatestMapFrom, combineLoadingStates, combineLoadingStatesStatus, distinctLoadingState, distinctUntilArrayLengthChanges, distinctUntilHasDifferentValues, distinctUntilItemsHaveDifferentValues, distinctUntilItemsValueChanges, distinctUntilKeysChange, distinctUntilMapHasDifferentKeys, distinctUntilModelIdChange, distinctUntilModelKeyChange, distinctUntilObjectKeyChange, distinctUntilObjectValuesChanged, emitAfterDelay, emitDelayObs, errorFromLoadingState, errorOnEmissionsInPeriod, errorPageResult, errorResult, factoryTimer, filterIfObjectValuesUnchanged, filterItemsWithObservableDecision, filterMaybe, filterMaybeArray, 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, skipFirstMaybe, startWithBeginLoading, successPageResult, successResult, switchMapFilterMaybe, switchMapMaybe, switchMapMaybeDefault, switchMapMaybeLoadingContextStream, switchMapObject, switchMapOnBoolean, switchMapToDefault, switchMapWhileFalse, switchMapWhileTrue, tapAfterTimeout, tapFirst, tapLog, tapOnLoadingStateSuccess, tapOnLoadingStateType, throwErrorAfterTimeout, timeoutStartWith, unknownLoadingStatesIsLoading, updatedStateForSetError, updatedStateForSetLoading, updatedStateForSetValue, useAsObservable, useFirst, valueFromFinishedLoadingState, valueFromLoadingState, valueFromObservableOrValue, valueFromObservableOrValueGetter, workFactory, workFactoryForConfigFactory };
|
|
6435
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PageNumber } from '@dereekb/util';
|
|
2
2
|
import { type Observable, type OperatorFunction } from 'rxjs';
|
|
3
|
-
import { type ListLoadingState, type PageLoadingState } from './loading.state';
|
|
3
|
+
import { LoadingStateValue, type ListLoadingState, type PageLoadingState } from './loading.state';
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if the loading state is not loading and is empty.
|
|
6
6
|
*
|
|
@@ -18,6 +18,14 @@ export declare function mapIsListLoadingStateWithEmptyValue<T>(): OperatorFuncti
|
|
|
18
18
|
* Wraps an observable output and maps the value to a PageLoadingState.
|
|
19
19
|
*/
|
|
20
20
|
export declare function pageLoadingStateFromObs<T>(obs: Observable<T>, firstOnly?: boolean, page?: PageNumber): Observable<PageLoadingState<T>>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the value once the LoadingState has finished loading, even if an error occured.
|
|
23
|
+
*
|
|
24
|
+
* The value is defaulted to an empty array.
|
|
25
|
+
*
|
|
26
|
+
* @returns Observable of the value
|
|
27
|
+
*/
|
|
28
|
+
export declare function arrayValueFromFinishedLoadingState<L extends ListLoadingState>(): OperatorFunction<L, LoadingStateValue<L>>;
|
|
21
29
|
/**
|
|
22
30
|
* @deprecated use isListLoadingStateWithEmptyValue instead.
|
|
23
31
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Maybe, type ReadableError, type EqualityComparatorFunction } from '@dereekb/util';
|
|
1
|
+
import { type Maybe, type ReadableError, type EqualityComparatorFunction, GetterOrValue, MaybeSoStrict } from '@dereekb/util';
|
|
2
2
|
import { type MonoTypeOperatorFunction, type OperatorFunction, type Observable, type ObservableInputTuple } from 'rxjs';
|
|
3
|
-
import { type LoadingState, type PageLoadingState, type MapLoadingStateResultsConfiguration, type LoadingStateValue, LoadingStateType, type LoadingStateWithValueType, type LoadingStateWithError } from './loading.state';
|
|
3
|
+
import { type LoadingState, type PageLoadingState, type MapLoadingStateResultsConfiguration, type LoadingStateValue, LoadingStateType, type LoadingStateWithValueType, type LoadingStateWithDefinedValue, type LoadingStateWithError } from './loading.state';
|
|
4
4
|
/**
|
|
5
5
|
* Wraps an observable output and maps the value to a LoadingState.
|
|
6
6
|
*
|
|
@@ -37,17 +37,27 @@ export declare function startWithBeginLoading<L extends LoadingState>(): MonoTyp
|
|
|
37
37
|
export declare function startWithBeginLoading<L extends LoadingState>(state?: Partial<LoadingState>): MonoTypeOperatorFunction<L>;
|
|
38
38
|
export declare function startWithBeginLoading<L extends PageLoadingState>(state?: Partial<PageLoadingState>): MonoTypeOperatorFunction<L>;
|
|
39
39
|
/**
|
|
40
|
-
* Returns the value
|
|
40
|
+
* Returns the current value from the LoadingState.
|
|
41
41
|
*/
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function currentValueFromLoadingState<L extends LoadingState>(): OperatorFunction<L, Maybe<LoadingStateValue<L>>>;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current non-null value from the LoadingState.
|
|
45
|
+
*
|
|
46
|
+
* Equivalent to currentValueFromLoadingState() and filterMaybe().
|
|
47
|
+
*/
|
|
48
|
+
export declare function valueFromLoadingState<L extends LoadingStateWithDefinedValue>(): OperatorFunction<L, MaybeSoStrict<LoadingStateValue<L>>>;
|
|
43
49
|
/**
|
|
44
50
|
* Returns the error once the LoadingState has finished loading with an error.
|
|
45
51
|
*/
|
|
46
52
|
export declare function errorFromLoadingState<L extends LoadingState>(): OperatorFunction<L, ReadableError>;
|
|
47
53
|
/**
|
|
48
54
|
* Returns the value once the LoadingState has finished loading, even if an error occured or there is no value.
|
|
55
|
+
*
|
|
56
|
+
* Can optionally specify a default value to use instead.
|
|
49
57
|
*/
|
|
50
|
-
export declare function valueFromFinishedLoadingState<L extends LoadingState>(): OperatorFunction<L,
|
|
58
|
+
export declare function valueFromFinishedLoadingState<L extends LoadingState>(defaultValue: GetterOrValue<LoadingStateValue<L>>): OperatorFunction<L, LoadingStateValue<L>>;
|
|
59
|
+
export declare function valueFromFinishedLoadingState<L extends LoadingState>(defaultValue?: Maybe<GetterOrValue<LoadingStateValue<L>>>): OperatorFunction<L, Maybe<LoadingStateValue<L>>>;
|
|
60
|
+
export declare function valueFromFinishedLoadingState<L extends LoadingStateWithDefinedValue>(): OperatorFunction<L, LoadingStateValue<L>>;
|
|
51
61
|
/**
|
|
52
62
|
* Executes a function when the piped LoadingState has the configured state.
|
|
53
63
|
*
|
package/src/lib/rxjs/value.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MonoTypeOperatorFunction, type Observable, type OperatorFunction } from 'rxjs';
|
|
2
|
-
import { type DecisionFunction, type GetterOrValue, type MapFunction, type Maybe } from '@dereekb/util';
|
|
2
|
+
import { type DecisionFunction, type GetterOrValue, type MapFunction, type Maybe, MaybeSoStrict } from '@dereekb/util';
|
|
3
3
|
import { type MaybeObservableOrValueGetter, type ObservableOrValueGetter, type MaybeObservableOrValue } from './getter';
|
|
4
4
|
import { type ObservableDecisionFunction } from './decision';
|
|
5
5
|
/**
|
|
@@ -58,6 +58,10 @@ export declare function checkIs<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>
|
|
|
58
58
|
* Observable filter that filters maybe value that are defined.
|
|
59
59
|
*/
|
|
60
60
|
export declare function filterMaybe<T>(): OperatorFunction<Maybe<T>, T>;
|
|
61
|
+
/**
|
|
62
|
+
* Equivalent to filterMaybe, but returns a strict MaybeSoStrict<T> value instead of the template type.
|
|
63
|
+
*/
|
|
64
|
+
export declare const filterMaybeStrict: <T>() => OperatorFunction<Maybe<T>, MaybeSoStrict<T>>;
|
|
61
65
|
/**
|
|
62
66
|
* Observable filter that filters maybe value from the input array of maybe values
|
|
63
67
|
*/
|
|
@@ -65,7 +69,15 @@ export declare function filterMaybeArray<T>(): OperatorFunction<Maybe<T>[], T[]>
|
|
|
65
69
|
/**
|
|
66
70
|
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
67
71
|
*/
|
|
68
|
-
export declare function
|
|
72
|
+
export declare function skipAllInitialMaybe<T>(): MonoTypeOperatorFunction<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Skips only the first maybe value, then returns all values afterwards.
|
|
75
|
+
*/
|
|
76
|
+
export declare function skipInitialMaybe<T>(): MonoTypeOperatorFunction<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Skips up to the given number of maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
79
|
+
*/
|
|
80
|
+
export declare function skipMaybes<T>(maxToSkip: number): MonoTypeOperatorFunction<T>;
|
|
69
81
|
/**
|
|
70
82
|
* Provides a switchMap that will emit the observable if the observable is defined, otherwise will return the default value.
|
|
71
83
|
*
|
|
@@ -165,3 +177,13 @@ export declare function emitDelayObs<T>(startWith: T, endWith: T, delayTime: May
|
|
|
165
177
|
* Emits a value after a given delay after every new emission.
|
|
166
178
|
*/
|
|
167
179
|
export declare function emitAfterDelay<T>(value: T, delayTime: number): MonoTypeOperatorFunction<T>;
|
|
180
|
+
/**
|
|
181
|
+
* @deprecated use switchMapFilterMaybe instead.
|
|
182
|
+
*/
|
|
183
|
+
export declare const switchMapMaybeObs: typeof switchMapFilterMaybe;
|
|
184
|
+
/**
|
|
185
|
+
* Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
|
|
186
|
+
*
|
|
187
|
+
* @deprecated use skipAllInitialMaybe instead.
|
|
188
|
+
*/
|
|
189
|
+
export declare const skipFirstMaybe: typeof skipAllInitialMaybe;
|