@dereekb/rxjs 11.0.21 → 11.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -1602,7 +1602,13 @@ function checkIs(isCheckFunction, value, defaultValueOnMaybe = false) {
1602
1602
  * Observable filter that filters maybe value that are defined.
1603
1603
  */
1604
1604
  function filterMaybe() {
1605
- return rxjs.filter(x => x != null);
1605
+ return rxjs.filter(util.isMaybeSo);
1606
+ }
1607
+ /**
1608
+ * Observable filter that filters maybe value from the input array of maybe values
1609
+ */
1610
+ function filterMaybeArray() {
1611
+ return rxjs.map(util.filterMaybeArrayValues);
1606
1612
  }
1607
1613
  /**
1608
1614
  * Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
@@ -1858,12 +1864,16 @@ class FilterSourceInstance {
1858
1864
  if (!this._initialFilterSub.subscription) {
1859
1865
  this._initialFilterSub.subscription = this._initialFilterTakesPriority.pipe(rxjs.switchMap(clearFilterOnInitialFilterPush => {
1860
1866
  if (clearFilterOnInitialFilterPush) {
1861
- return this._initialFilter.pipe(rxjs.switchMap(x => x ? x : rxjs.EMPTY), rxjs.filter(x => Boolean(x)), rxjs.skip(1) // skip the first emission
1867
+ return this._initialFilter.pipe(rxjs.switchMap(x => x ? x : rxjs.EMPTY), filterMaybe(), rxjs.map(() => true), rxjs.skip(1) // skip the first emission
1862
1868
  );
1863
1869
  } else {
1864
1870
  return rxjs.EMPTY;
1865
1871
  }
1866
- })).subscribe(() => this.resetFilter());
1872
+ }), rxjs.defaultIfEmpty(false)).subscribe(clear => {
1873
+ if (clear) {
1874
+ this.resetFilter();
1875
+ }
1876
+ });
1867
1877
  }
1868
1878
  }
1869
1879
  // MARK: Cleanup
@@ -1963,7 +1973,8 @@ class FilterMapItem {
1963
1973
  const currentObs = this._obs.value;
1964
1974
  const existingObsItem = currentObs.find(x => x.obs === obs);
1965
1975
  if (!existingObsItem) {
1966
- const i = this._i++;
1976
+ const i = this._i;
1977
+ this._i += 1;
1967
1978
  const deleteOnComplete = obs.pipe(rxjs.finalize(() => {
1968
1979
  this._deleteFilterObs(i);
1969
1980
  })).subscribe();
@@ -4234,7 +4245,7 @@ function isPageLoadingStateMetadataEqual(a, b) {
4234
4245
  }
4235
4246
  function mergeLoadingStates(...args) {
4236
4247
  var _loadingStates$find;
4237
- const validArgs = util.filterMaybeValues(args); // filter out any undefined values
4248
+ const validArgs = util.filterMaybeArrayValues(args); // filter out any undefined values
4238
4249
  const lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
4239
4250
  const loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
4240
4251
  const mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : (...inputArgs) => util.mergeObjects(inputArgs);
@@ -4479,7 +4490,7 @@ function loadingStateFromObs(obs, firstOnly) {
4479
4490
  return obs.pipe(rxjs.map(value => successResult(value)), rxjs.catchError(error => rxjs.of(errorResult(error))), timeoutStartWith(beginLoading(), 50), rxjs.shareReplay(1));
4480
4491
  }
4481
4492
  function combineLoadingStates(...args) {
4482
- const validArgs = util.filterMaybeValues(args); // filter out any undefined values
4493
+ const validArgs = util.filterMaybeArrayValues(args); // filter out any undefined values
4483
4494
  const lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
4484
4495
  const obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
4485
4496
  const mergeFn = lastValueIsMergeFn ? validArgs[validArgs.length - 1] : undefined;
@@ -4599,6 +4610,25 @@ function mapLoadingStateValueWithOperator(operator, mapOnUndefined = false) {
4599
4610
  }));
4600
4611
  };
4601
4612
  }
4613
+ function catchLoadingStateErrorWithOperator(operator) {
4614
+ return obs => {
4615
+ return obs.pipe(rxjs.switchMap(state => {
4616
+ let mappedObs;
4617
+ if (isLoadingStateWithError(state)) {
4618
+ // map the value using the error state
4619
+ mappedObs = rxjs.of(state).pipe(operator,
4620
+ // if the operator does not return nearly instantly, then return the current state, minus a value
4621
+ timeoutStartWith(Object.assign({}, state, {
4622
+ loading: true,
4623
+ value: undefined
4624
+ }), 0));
4625
+ } else {
4626
+ mappedObs = rxjs.of(state);
4627
+ }
4628
+ return mappedObs;
4629
+ }));
4630
+ };
4631
+ }
4602
4632
  function distinctLoadingState(inputConfig) {
4603
4633
  const {
4604
4634
  compareOnUndefinedValue,
@@ -5824,6 +5854,7 @@ exports.asyncPusher = asyncPusher;
5824
5854
  exports.asyncPusherCache = asyncPusherCache;
5825
5855
  exports.beginLoading = beginLoading;
5826
5856
  exports.beginLoadingPage = beginLoadingPage;
5857
+ exports.catchLoadingStateErrorWithOperator = catchLoadingStateErrorWithOperator;
5827
5858
  exports.checkIs = checkIs;
5828
5859
  exports.cleanup = cleanup;
5829
5860
  exports.cleanupDestroyable = cleanupDestroyable;
@@ -5854,6 +5885,7 @@ exports.factoryTimer = factoryTimer;
5854
5885
  exports.filterIfObjectValuesUnchanged = filterIfObjectValuesUnchanged;
5855
5886
  exports.filterItemsWithObservableDecision = filterItemsWithObservableDecision;
5856
5887
  exports.filterMaybe = filterMaybe;
5888
+ exports.filterMaybeArray = filterMaybeArray;
5857
5889
  exports.filterUnique = filterUnique;
5858
5890
  exports.filterWithSearchString = filterWithSearchString;
5859
5891
  exports.flattenAccumulatorResultItemArray = flattenAccumulatorResultItemArray;
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isObservable, of, switchMap, map, filter, skipWhile, EMPTY, combineLatest, delay, startWith, distinctUntilChanged, mergeMap, BehaviorSubject, shareReplay, skip, first, merge, finalize, firstValueFrom, scan, exhaustMap, identity, throttleTime, timeout, tap, throwError, timer, takeWhile, delayWhen, asyncScheduler, from, combineLatestWith, catchError, defaultIfEmpty } from 'rxjs';
2
- import { getValueFromGetter, isMaybeSo, areEqualPOJOValues, convertToArray, asGetter, performTaskLoop, isMaybeNot, pushItemOrArrayItemsIntoArray, pushArrayItemsIntoArray, forEachWithArray, asArray, filterAndMapFunction, objectKeysEqualityComparatorFunction, objectKeyEqualityComparatorFunction, asPromise, randomNumberFactory, mapKeysIntersectionObjectToArray, mapsHaveSameKeys, incrementingNumberFactory, filterUniqueFunction, build, cachedGetter, allKeyValueTuples, keyValueMapFactory, multiKeyValueMapFactory, timePeriodCounter, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, hasSameValues, compareEqualityWithValueFromItemsFunction, searchStringFilterFunction, objectHasKey, toReadableError, reduceBooleansWithOr, reduceBooleansWithAnd, valuesAreBothNullishOrEquivalent, filterMaybeValues, mergeObjects, safeCompareEquality, limitArray, hasNonNullValue, mapFunctionOutputPair, lastValue, flattenArray, filteredPage, FIRST_PAGE, hasValueOrNotEmpty, getNextPageNumber, reduceBooleansWithOrFn, MS_IN_SECOND } from '@dereekb/util';
1
+ import { isObservable, of, switchMap, map, filter, skipWhile, EMPTY, combineLatest, delay, startWith, distinctUntilChanged, mergeMap, BehaviorSubject, shareReplay, skip, defaultIfEmpty, first, merge, finalize, firstValueFrom, scan, exhaustMap, identity, throttleTime, timeout, tap, throwError, timer, takeWhile, delayWhen, asyncScheduler, from, combineLatestWith, catchError } from 'rxjs';
2
+ import { getValueFromGetter, isMaybeSo, filterMaybeArrayValues, areEqualPOJOValues, convertToArray, asGetter, performTaskLoop, isMaybeNot, pushItemOrArrayItemsIntoArray, pushArrayItemsIntoArray, forEachWithArray, asArray, filterAndMapFunction, objectKeysEqualityComparatorFunction, objectKeyEqualityComparatorFunction, asPromise, randomNumberFactory, mapKeysIntersectionObjectToArray, mapsHaveSameKeys, incrementingNumberFactory, filterUniqueFunction, build, cachedGetter, allKeyValueTuples, keyValueMapFactory, multiKeyValueMapFactory, timePeriodCounter, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, hasSameValues, compareEqualityWithValueFromItemsFunction, searchStringFilterFunction, objectHasKey, toReadableError, reduceBooleansWithOr, reduceBooleansWithAnd, valuesAreBothNullishOrEquivalent, mergeObjects, safeCompareEquality, limitArray, hasNonNullValue, mapFunctionOutputPair, lastValue, flattenArray, filteredPage, FIRST_PAGE, hasValueOrNotEmpty, getNextPageNumber, reduceBooleansWithOrFn, MS_IN_SECOND } from '@dereekb/util';
3
3
 
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
 
@@ -1632,7 +1632,14 @@ function checkIs(isCheckFunction, value, defaultValueOnMaybe = false) {
1632
1632
  * Observable filter that filters maybe value that are defined.
1633
1633
  */
1634
1634
  function filterMaybe() {
1635
- return filter(x => x != null);
1635
+ return filter(isMaybeSo);
1636
+ }
1637
+
1638
+ /**
1639
+ * Observable filter that filters maybe value from the input array of maybe values
1640
+ */
1641
+ function filterMaybeArray() {
1642
+ return map(filterMaybeArrayValues);
1636
1643
  }
1637
1644
 
1638
1645
  /**
@@ -1943,12 +1950,16 @@ class FilterSourceInstance {
1943
1950
  if (!this._initialFilterSub.subscription) {
1944
1951
  this._initialFilterSub.subscription = this._initialFilterTakesPriority.pipe(switchMap(clearFilterOnInitialFilterPush => {
1945
1952
  if (clearFilterOnInitialFilterPush) {
1946
- return this._initialFilter.pipe(switchMap(x => x ? x : EMPTY), filter(x => Boolean(x)), skip(1) // skip the first emission
1953
+ return this._initialFilter.pipe(switchMap(x => x ? x : EMPTY), filterMaybe(), map(() => true), skip(1) // skip the first emission
1947
1954
  );
1948
1955
  } else {
1949
1956
  return EMPTY;
1950
1957
  }
1951
- })).subscribe(() => this.resetFilter());
1958
+ }), defaultIfEmpty(false)).subscribe(clear => {
1959
+ if (clear) {
1960
+ this.resetFilter();
1961
+ }
1962
+ });
1952
1963
  }
1953
1964
  }
1954
1965
 
@@ -2055,7 +2066,8 @@ class FilterMapItem {
2055
2066
  const currentObs = this._obs.value;
2056
2067
  const existingObsItem = currentObs.find(x => x.obs === obs);
2057
2068
  if (!existingObsItem) {
2058
- const i = this._i++;
2069
+ const i = this._i;
2070
+ this._i += 1;
2059
2071
  const deleteOnComplete = obs.pipe(finalize(() => {
2060
2072
  this._deleteFilterObs(i);
2061
2073
  })).subscribe();
@@ -4483,7 +4495,7 @@ function isPageLoadingStateMetadataEqual(a, b) {
4483
4495
 
4484
4496
  function mergeLoadingStates(...args) {
4485
4497
  var _loadingStates$find;
4486
- const validArgs = filterMaybeValues(args); // filter out any undefined values
4498
+ const validArgs = filterMaybeArrayValues(args); // filter out any undefined values
4487
4499
  const lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
4488
4500
  const loadingStates = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
4489
4501
  const mergeFn = lastValueIsMergeFn ? args[validArgs.length - 1] : (...inputArgs) => mergeObjects(inputArgs);
@@ -4757,7 +4769,7 @@ function loadingStateFromObs(obs, firstOnly) {
4757
4769
  */
4758
4770
 
4759
4771
  function combineLoadingStates(...args) {
4760
- const validArgs = filterMaybeValues(args); // filter out any undefined values
4772
+ const validArgs = filterMaybeArrayValues(args); // filter out any undefined values
4761
4773
  const lastValueIsMergeFn = typeof validArgs[validArgs.length - 1] === 'function';
4762
4774
  const obsArgs = lastValueIsMergeFn ? validArgs.slice(0, validArgs.length - 1) : validArgs;
4763
4775
  const mergeFn = lastValueIsMergeFn ? validArgs[validArgs.length - 1] : undefined;
@@ -4879,7 +4891,7 @@ function mapLoadingState(config) {
4879
4891
  }
4880
4892
 
4881
4893
  /**
4882
- * Convenience function for mapping the loading state's value from one value to another using an arbitrary operator.
4894
+ * Convenience function for catching the loading state's error from one value to another using an arbitrary operator.
4883
4895
  */
4884
4896
 
4885
4897
  function mapLoadingStateValueWithOperator(operator, mapOnUndefined = false) {
@@ -4915,6 +4927,30 @@ function mapLoadingStateValueWithOperator(operator, mapOnUndefined = false) {
4915
4927
  };
4916
4928
  }
4917
4929
 
4930
+ /**
4931
+ * Convenience function for catching an LoadingStateWithError and returning a new LoadingState.
4932
+ */
4933
+
4934
+ function catchLoadingStateErrorWithOperator(operator) {
4935
+ return obs => {
4936
+ return obs.pipe(switchMap(state => {
4937
+ let mappedObs;
4938
+ if (isLoadingStateWithError(state)) {
4939
+ // map the value using the error state
4940
+ mappedObs = of(state).pipe(operator,
4941
+ // if the operator does not return nearly instantly, then return the current state, minus a value
4942
+ timeoutStartWith(Object.assign({}, state, {
4943
+ loading: true,
4944
+ value: undefined
4945
+ }), 0));
4946
+ } else {
4947
+ mappedObs = of(state);
4948
+ }
4949
+ return mappedObs;
4950
+ }));
4951
+ };
4952
+ }
4953
+
4918
4954
  /**
4919
4955
  * A special distinctUntilChanged-like operator for LoadingState and PageLoadingState.
4920
4956
  *
@@ -6165,4 +6201,4 @@ function workFactoryForConfigFactory(configFactory) {
6165
6201
  };
6166
6202
  }
6167
6203
 
6168
- export { AbstractLoadingStateContextInstance, DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, ListLoadingStateContextInstance, LoadingStateContextInstance, LoadingStateType, LockSet, MultiSubscriptionObject, PresetFilterSource, SimpleLoadingContext, SubscriptionObject, ValuesLoadingContext, WorkInstance, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState, allLoadingStatesHaveFinishedLoading, areAllLoadingStatesFinishedLoading, asObservable, asObservableFromGetter, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, 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, filterUnique, filterWithSearchString, flattenAccumulatorResultItemArray, idleLoadingState, incrementingNumberTimer, initialize, invertObservableDecision, isAnyLoadingStateInLoadingState, isErrorLoadingState, isItemPageIteratorResultEndResult, isListLoadingStateEmpty, isListLoadingStateWithEmptyValue, isLoading, isLoadingStateFinishedLoading, isLoadingStateFinishedLoadingWithDefinedValue, isLoadingStateFinishedLoadingWithError, isLoadingStateInErrorState, isLoadingStateInIdleState, isLoadingStateInLoadingState, isLoadingStateInSuccessState, isLoadingStateLoading, 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, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mapMultipleLoadingStateResults, mapPageItemIteration, mappedPageItemIteration, 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, switchMapMaybeDefault, 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 };
6204
+ export { AbstractLoadingStateContextInstance, DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, ListLoadingStateContextInstance, LoadingStateContextInstance, 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, 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, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mapMultipleLoadingStateResults, mapPageItemIteration, mappedPageItemIteration, 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, switchMapMaybeDefault, 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
  {
2
2
  "name": "@dereekb/rxjs",
3
- "version": "11.0.21",
3
+ "version": "11.1.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -6,11 +6,11 @@ import { type Destroyable, type Maybe } from '@dereekb/util';
6
6
  * A basic FilterSource implementation.
7
7
  */
8
8
  export declare class FilterSourceInstance<F> implements FilterSource<F>, Destroyable {
9
- private _initialFilterSub;
10
- private _initialFilterTakesPriority;
11
- private _filter;
12
- private _initialFilter;
13
- private _defaultFilter;
9
+ private readonly _initialFilterSub;
10
+ private readonly _initialFilterTakesPriority;
11
+ private readonly _filter;
12
+ private readonly _initialFilter;
13
+ private readonly _defaultFilter;
14
14
  readonly defaultFilter$: Observable<Maybe<F>>;
15
15
  readonly initialFilter$: Observable<Maybe<F>>;
16
16
  /**
@@ -1,6 +1,6 @@
1
1
  import { type Maybe, type ReadableError, type EqualityComparatorFunction } 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 } from './loading.state';
3
+ import { type LoadingState, type PageLoadingState, type MapLoadingStateResultsConfiguration, type LoadingStateValue, LoadingStateType, type LoadingStateWithValueType, type LoadingStateWithError } from './loading.state';
4
4
  /**
5
5
  * Wraps an observable output and maps the value to a LoadingState.
6
6
  *
@@ -71,11 +71,17 @@ export declare function mapLoadingState<A, B, L extends LoadingState<A> = Loadin
71
71
  export declare function mapLoadingState<A, B, L extends PageLoadingState<A> = PageLoadingState<A>, O extends PageLoadingState<B> = PageLoadingState<B>>(config: MapLoadingStateResultsConfiguration<A, B, L, O>): OperatorFunction<L, O>;
72
72
  export declare function mapLoadingState<A, B, L extends Partial<PageLoadingState<A>> = Partial<PageLoadingState<A>>, O extends Partial<PageLoadingState<B>> = Partial<PageLoadingState<B>>>(config: MapLoadingStateResultsConfiguration<A, B, L, O>): OperatorFunction<L, O>;
73
73
  /**
74
- * Convenience function for mapping the loading state's value from one value to another using an arbitrary operator.
74
+ * Convenience function for catching the loading state's error from one value to another using an arbitrary operator.
75
75
  */
76
76
  export declare function mapLoadingStateValueWithOperator<L extends LoadingState, O>(operator: OperatorFunction<LoadingStateValue<L>, O>, mapOnUndefined?: boolean): OperatorFunction<L, LoadingStateWithValueType<L, O>>;
77
77
  export declare function mapLoadingStateValueWithOperator<L extends PageLoadingState, O>(operator: OperatorFunction<LoadingStateValue<L>, O>, mapOnUndefined?: boolean): OperatorFunction<L, LoadingStateWithValueType<L, O>>;
78
78
  export declare function mapLoadingStateValueWithOperator<L extends Partial<PageLoadingState>, O>(operator: OperatorFunction<LoadingStateValue<L>, O>, mapOnUndefined?: boolean): OperatorFunction<L, LoadingStateWithValueType<L, O>>;
79
+ /**
80
+ * Convenience function for catching an LoadingStateWithError and returning a new LoadingState.
81
+ */
82
+ export declare function catchLoadingStateErrorWithOperator<L extends LoadingState>(operator: OperatorFunction<L & LoadingStateWithError, L>): MonoTypeOperatorFunction<L>;
83
+ export declare function catchLoadingStateErrorWithOperator<L extends PageLoadingState>(operator: OperatorFunction<L & LoadingStateWithError, L>): MonoTypeOperatorFunction<L>;
84
+ export declare function catchLoadingStateErrorWithOperator<L extends Partial<PageLoadingState>>(operator: OperatorFunction<L & LoadingStateWithError, L>): MonoTypeOperatorFunction<L>;
79
85
  export interface DistinctLoadingStateConfig<L extends LoadingState> {
80
86
  /**
81
87
  * Whether or not to pass the retained value when the next LoadingState's value (the value being considered by this DecisionFunction) is null/undefined.
@@ -19,6 +19,10 @@ export declare function checkIs<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>
19
19
  * Observable filter that filters maybe value that are defined.
20
20
  */
21
21
  export declare function filterMaybe<T>(): OperatorFunction<Maybe<T>, T>;
22
+ /**
23
+ * Observable filter that filters maybe value from the input array of maybe values
24
+ */
25
+ export declare function filterMaybeArray<T>(): OperatorFunction<Maybe<T>[], T[]>;
22
26
  /**
23
27
  * Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
24
28
  */