@dereekb/rxjs 10.1.4 → 10.1.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
@@ -4,11 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var rxjs = require('rxjs');
6
6
  var util = require('@dereekb/util');
7
- var ms = require('ms');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var ms__default = /*#__PURE__*/_interopDefaultLegacy(ms);
12
7
 
13
8
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
14
9
 
@@ -5273,7 +5268,7 @@ function onLockSetNextUnlock({
5273
5268
  timeout: inputTimeout,
5274
5269
  delayTime
5275
5270
  }) {
5276
- const timeoutTime = inputTimeout !== null && inputTimeout !== void 0 ? inputTimeout : ms__default["default"]('50s');
5271
+ const timeoutTime = inputTimeout !== null && inputTimeout !== void 0 ? inputTimeout : util.MS_IN_SECOND * 50;
5277
5272
  return lockSet.isUnlocked$.pipe(rxjs.filter(x => x), rxjs.delay(delayTime !== null && delayTime !== void 0 ? delayTime : 0), rxjs.timeout({
5278
5273
  first: timeoutTime,
5279
5274
  with: () => rxjs.of(false).pipe(rxjs.tap(() => console.warn('LockSet time out. Potential issue detected.')))
@@ -5481,6 +5476,22 @@ class WorkInstance {
5481
5476
  throw e;
5482
5477
  });
5483
5478
  }
5479
+ /**
5480
+ * Performs a synchronous task that returns the value to resolve.
5481
+ *
5482
+ * If an error is thrown, the error is forwarded to the reject function.
5483
+ *
5484
+ * @param fn
5485
+ */
5486
+ performTaskWithReturnValue(fn) {
5487
+ try {
5488
+ const result = fn();
5489
+ this.success(result);
5490
+ } catch (e) {
5491
+ this.reject(e);
5492
+ throw e;
5493
+ }
5494
+ }
5484
5495
  /**
5485
5496
  * Begins working using a promise.
5486
5497
  */
package/index.esm.js CHANGED
@@ -1,6 +1,5 @@
1
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, 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 } from '@dereekb/util';
3
- import ms from 'ms';
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';
4
3
 
5
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
5
 
@@ -5616,7 +5615,7 @@ function onLockSetNextUnlock({
5616
5615
  timeout: inputTimeout,
5617
5616
  delayTime
5618
5617
  }) {
5619
- const timeoutTime = inputTimeout != null ? inputTimeout : ms('50s');
5618
+ const timeoutTime = inputTimeout != null ? inputTimeout : MS_IN_SECOND * 50;
5620
5619
  return lockSet.isUnlocked$.pipe(filter(x => x), delay(delayTime != null ? delayTime : 0), timeout({
5621
5620
  first: timeoutTime,
5622
5621
  with: () => of(false).pipe(tap(() => console.warn('LockSet time out. Potential issue detected.')))
@@ -5835,6 +5834,23 @@ class WorkInstance {
5835
5834
  });
5836
5835
  }
5837
5836
 
5837
+ /**
5838
+ * Performs a synchronous task that returns the value to resolve.
5839
+ *
5840
+ * If an error is thrown, the error is forwarded to the reject function.
5841
+ *
5842
+ * @param fn
5843
+ */
5844
+ performTaskWithReturnValue(fn) {
5845
+ try {
5846
+ const result = fn();
5847
+ this.success(result);
5848
+ } catch (e) {
5849
+ this.reject(e);
5850
+ throw e;
5851
+ }
5852
+ }
5853
+
5838
5854
  /**
5839
5855
  * Begins working using a promise.
5840
5856
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/rxjs",
3
- "version": "10.1.4",
3
+ "version": "10.1.6",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -18,8 +18,7 @@
18
18
  "dependencies": {},
19
19
  "peerDependencies": {
20
20
  "rxjs": "^7.5.0",
21
- "@dereekb/util": "*",
22
- "ms": "^3.0.0-canary.1"
21
+ "@dereekb/util": "*"
23
22
  },
24
23
  "module": "./index.esm.js",
25
24
  "main": "./index.cjs.js"
@@ -48,6 +48,14 @@ export declare class WorkInstance<I = unknown, O = unknown> implements Destroyab
48
48
  * @param loadingStateObs
49
49
  */
50
50
  performTaskWithLoadingState<T>(loadingStateObs: Promise<LoadingState<T>> | Observable<Maybe<LoadingState<T>>>): Promise<T>;
51
+ /**
52
+ * Performs a synchronous task that returns the value to resolve.
53
+ *
54
+ * If an error is thrown, the error is forwarded to the reject function.
55
+ *
56
+ * @param fn
57
+ */
58
+ performTaskWithReturnValue(fn: () => O): void;
51
59
  /**
52
60
  * Begins working using a promise.
53
61
  */