@dereekb/rxjs 13.0.7 → 13.2.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.
Files changed (52) hide show
  1. package/index.cjs.js +1284 -336
  2. package/index.cjs.js.map +1 -1
  3. package/index.esm.js +1284 -336
  4. package/index.esm.js.map +1 -1
  5. package/package.json +2 -2
  6. package/src/lib/filter/filter.d.ts +28 -13
  7. package/src/lib/filter/filter.map.d.ts +69 -2
  8. package/src/lib/filter/filter.preset.d.ts +35 -0
  9. package/src/lib/filter/filter.source.d.ts +61 -2
  10. package/src/lib/iterator/iteration.accumulator.d.ts +39 -13
  11. package/src/lib/iterator/iteration.accumulator.rxjs.d.ts +25 -8
  12. package/src/lib/iterator/iteration.d.ts +16 -5
  13. package/src/lib/iterator/iteration.mapped.d.ts +19 -6
  14. package/src/lib/iterator/iteration.mapped.page.d.ts +9 -6
  15. package/src/lib/iterator/iteration.next.d.ts +17 -14
  16. package/src/lib/iterator/iterator.page.d.ts +54 -16
  17. package/src/lib/loading/loading.context.rxjs.d.ts +17 -1
  18. package/src/lib/loading/loading.context.simple.d.ts +38 -1
  19. package/src/lib/loading/loading.context.state.d.ts +32 -4
  20. package/src/lib/loading/loading.context.state.list.d.ts +25 -3
  21. package/src/lib/loading/loading.context.value.d.ts +43 -3
  22. package/src/lib/loading/loading.state.d.ts +272 -41
  23. package/src/lib/loading/loading.state.list.d.ts +50 -9
  24. package/src/lib/lock.d.ts +149 -6
  25. package/src/lib/object.d.ts +28 -4
  26. package/src/lib/rxjs/array.d.ts +39 -13
  27. package/src/lib/rxjs/boolean.d.ts +8 -4
  28. package/src/lib/rxjs/decision.d.ts +13 -7
  29. package/src/lib/rxjs/delta.d.ts +14 -2
  30. package/src/lib/rxjs/expires.d.ts +20 -8
  31. package/src/lib/rxjs/factory.d.ts +16 -3
  32. package/src/lib/rxjs/getter.d.ts +24 -10
  33. package/src/lib/rxjs/key.d.ts +7 -5
  34. package/src/lib/rxjs/lifecycle.d.ts +10 -7
  35. package/src/lib/rxjs/loading.d.ts +10 -2
  36. package/src/lib/rxjs/map.d.ts +6 -5
  37. package/src/lib/rxjs/misc.d.ts +26 -6
  38. package/src/lib/rxjs/model.d.ts +2 -2
  39. package/src/lib/rxjs/number.d.ts +8 -4
  40. package/src/lib/rxjs/rxjs.async.d.ts +20 -7
  41. package/src/lib/rxjs/rxjs.d.ts +26 -18
  42. package/src/lib/rxjs/rxjs.error.d.ts +17 -0
  43. package/src/lib/rxjs/rxjs.map.d.ts +37 -9
  44. package/src/lib/rxjs/rxjs.unique.d.ts +6 -3
  45. package/src/lib/rxjs/set.d.ts +34 -0
  46. package/src/lib/rxjs/string.d.ts +18 -1
  47. package/src/lib/rxjs/timeout.d.ts +21 -1
  48. package/src/lib/rxjs/use.d.ts +4 -2
  49. package/src/lib/rxjs/value.d.ts +73 -39
  50. package/src/lib/subscription.d.ts +80 -3
  51. package/src/lib/work/work.factory.d.ts +42 -9
  52. package/src/lib/work/work.instance.d.ts +26 -2
@@ -2,15 +2,16 @@ import { type OperatorFunction, type MonoTypeOperatorFunction } from 'rxjs';
2
2
  import { type MapKeysIntersectionObject } from '@dereekb/util';
3
3
  import { type ObservableOrValue } from './getter';
4
4
  /**
5
- * OperatorFunction that pipes the input from the object with a keys observable to produce the result of mapKeysIntersectionObjectToArray.
5
+ * RxJS operator that extracts values from a keyed object using a keys observable,
6
+ * returning only the values whose keys are present in both.
6
7
  *
7
- * @param keysObs
8
- * @returns
8
+ * @param keysObs - observable (or static value) of keys to intersect with
9
+ * @returns an operator that maps a keyed object to an array of matching values
9
10
  */
10
11
  export declare function mapKeysIntersectionToArray<T>(keysObs: ObservableOrValue<Iterable<string>>): OperatorFunction<MapKeysIntersectionObject<T>, T[]>;
11
12
  /**
12
- * Operatorfunction using distinctUntilChanged to check that two maps have the same keys.
13
+ * `distinctUntilChanged` variant for `Map` instances that only emits when the set of map keys changes.
13
14
  *
14
- * @returns
15
+ * @returns an operator that filters out Maps with unchanged key sets
15
16
  */
16
17
  export declare function distinctUntilMapHasDifferentKeys<I extends Map<K, V>, K, V>(): MonoTypeOperatorFunction<I>;
@@ -1,18 +1,38 @@
1
1
  import { type RandomNumberFactoryConfig, type RandomNumberFactory } from '@dereekb/util';
2
2
  import { type MonoTypeOperatorFunction, type SchedulerLike } from 'rxjs';
3
3
  /**
4
- * Used to log a message to the console.
4
+ * RxJS operator that logs each emission to the console as a side-effect.
5
5
  *
6
- * @param messageOrFunction
7
- * @returns
6
+ * Accepts either a static label or a function that produces log arguments from the emitted value.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * source$.pipe(
11
+ * tapLog('Value:')
12
+ * ).subscribe();
13
+ * // logs "Value: <emitted value>" for each emission
14
+ * ```
15
+ *
16
+ * @param messageOrFunction - static label or function returning log arguments
17
+ * @param consoleLogFn - which console method to use (defaults to 'log')
18
+ * @returns a tap operator that logs emissions
8
19
  */
9
20
  export declare function tapLog<T = unknown>(message: string | number, consoleLogFn?: 'log' | 'warn' | 'error'): MonoTypeOperatorFunction<T>;
10
21
  export declare function tapLog<T = unknown>(messageFunction: (value: T) => unknown[], consoleLogFn?: 'log' | 'warn' | 'error'): MonoTypeOperatorFunction<T>;
11
22
  /**
12
- * Used to make a random delay for each observable value.
23
+ * RxJS operator that adds a random delay before each emission.
24
+ *
25
+ * Useful for simulating network latency or staggering requests.
13
26
  *
14
- * @param maxOrArgs
15
- * @returns
27
+ * @param maxOrArgs - maximum delay in ms, or a full random number config
28
+ * @returns an operator that delays each emission by a random amount
16
29
  */
17
30
  export declare function randomDelay<T = unknown>(maxOrArgs: number | RandomNumberFactoryConfig): MonoTypeOperatorFunction<T>;
31
+ /**
32
+ * RxJS operator that adds a random delay using a custom random number generator.
33
+ *
34
+ * @param makeRandomDelay - factory that produces random delay values
35
+ * @param scheduler - the scheduler to use for the delay (defaults to asyncScheduler)
36
+ * @returns an operator that delays each emission
37
+ */
18
38
  export declare function randomDelayWithRandomFunction<T = unknown>(makeRandomDelay: RandomNumberFactory, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
@@ -1,9 +1,9 @@
1
1
  import { type ModelKeyRef, type UniqueModel } from '@dereekb/util';
2
2
  /**
3
- * distinctUntilChanged() that compares id values.
3
+ * `distinctUntilChanged` variant that only emits when the model's `id` property changes.
4
4
  */
5
5
  export declare function distinctUntilModelIdChange<T extends UniqueModel>(): import("rxjs").MonoTypeOperatorFunction<T>;
6
6
  /**
7
- * distinctUntilChanged() that compares key values.
7
+ * `distinctUntilChanged` variant that only emits when the model's `key` property changes.
8
8
  */
9
9
  export declare function distinctUntilModelKeyChange<T extends ModelKeyRef>(): import("rxjs").MonoTypeOperatorFunction<T>;
@@ -2,7 +2,11 @@ import { type IncrementingNumberFactoryConfig } from '@dereekb/util';
2
2
  import { type Observable, type OperatorFunction } from 'rxjs';
3
3
  import { type FactoryTimerConfig } from './factory';
4
4
  /**
5
- * Similar to count(), but counts emissions as they occur using scan.
5
+ * RxJS operator that counts emissions as they occur using `scan`, emitting the running count
6
+ * after each emission (unlike `count()` which only emits on completion).
7
+ *
8
+ * @param startAt - initial count value (defaults to 0)
9
+ * @returns an operator that emits the running emission count
6
10
  */
7
11
  export declare function scanCount(startAt?: number): OperatorFunction<unknown, number>;
8
12
  /**
@@ -11,9 +15,9 @@ export declare function scanCount(startAt?: number): OperatorFunction<unknown, n
11
15
  export interface IncrementingTimerConfig extends Omit<FactoryTimerConfig<number>, 'factory'>, IncrementingNumberFactoryConfig {
12
16
  }
13
17
  /**
14
- * Creates a factoryTimer for incrementing numbers.
18
+ * Creates a {@link factoryTimer} that emits incrementing numbers on an interval.
15
19
  *
16
- * @param config
17
- * @returns
20
+ * @param config - timer and incrementing number configuration
21
+ * @returns an observable of incrementing numbers
18
22
  */
19
23
  export declare function incrementingNumberTimer(config?: IncrementingTimerConfig): Observable<number>;
@@ -40,10 +40,23 @@ export interface AsyncPusherConfig<T> {
40
40
  cleanupObs?: Observable<unknown>;
41
41
  }
42
42
  /**
43
- * Creates an AsyncPusher.
43
+ * Creates an {@link AsyncPusher} — a callable function backed by a throttled {@link BehaviorSubject}.
44
44
  *
45
- * @param config
46
- * @returns
45
+ * Each call pushes a value onto the internal subject and returns the shared, throttled observable.
46
+ * Useful for debouncing repeated calls while sharing a single observable output.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const pusher = asyncPusher<string>({ throttle: 100 });
51
+ * const result$ = pusher('hello');
52
+ * // subsequent calls within 100ms are throttled
53
+ * pusher('world');
54
+ * // clean up
55
+ * pusher.destroy();
56
+ * ```
57
+ *
58
+ * @param config - optional throttle, distinct, and pipe settings
59
+ * @returns an async pusher function
47
60
  */
48
61
  export declare function asyncPusher<T>(config?: AsyncPusherConfig<T>): AsyncPusher<T>;
49
62
  /**
@@ -51,11 +64,11 @@ export declare function asyncPusher<T>(config?: AsyncPusherConfig<T>): AsyncPush
51
64
  */
52
65
  export type AsyncPusherCache<T> = CachedFactoryWithInput<AsyncPusher<T>, Observable<unknown>>;
53
66
  /**
54
- * Creates a cache that returns an AsyncPusher.
67
+ * Creates a cached factory that lazily creates and returns an {@link AsyncPusher}.
55
68
  *
56
- * The CachedFactoryWithInput resunt can optionally be pass an observable to watch for the cleanup process.
69
+ * The factory optionally accepts a cleanup observable when it completes, the pusher is destroyed.
57
70
  *
58
- * @param config
59
- * @returns
71
+ * @param config - optional config passed to the underlying async pusher
72
+ * @returns a cached factory that produces an async pusher
60
73
  */
61
74
  export declare function asyncPusherCache<T>(config?: AsyncPusherConfig<T>): AsyncPusherCache<T>;
@@ -1,38 +1,46 @@
1
1
  import { type Getter, type Maybe } from '@dereekb/util';
2
2
  import { type Observable, type MonoTypeOperatorFunction } from 'rxjs';
3
3
  /**
4
- * Merges both startWith and tapFirst to initialize a pipe.
4
+ * Combines `startWith` and {@link tapFirst} to initialize an observable pipe with a side-effect on the first emission.
5
5
  *
6
- * @param initial
7
- * @param tap
8
- * @param skipFirst
9
- * @returns
6
+ * Emits the `initial` value first, then taps on the first emitted value to run the provided callback.
7
+ *
8
+ * @param tap - side-effect function called with the first value
9
+ * @param initial - optional starting value emitted before the source
10
+ * @param skipFirst - if true, skips tapping the initial value
11
+ * @returns an operator that initializes the pipe with a tap
10
12
  */
11
13
  export declare function initialize<T>(tap: (value: Maybe<T>) => void, initial?: Maybe<T>, skipFirst?: boolean): MonoTypeOperatorFunction<T>;
12
14
  /**
13
- * Taps once on the first element.
15
+ * Executes a side-effect on the first emission from the observable, then passes all values through.
14
16
  *
15
- * @param tap
16
- * @param skipFirst
17
- * @returns
17
+ * @param tap - the side-effect function to call once
18
+ * @param skipFirst - if true, skips the very first emission before tapping
19
+ * @returns an operator that taps the first value
18
20
  */
19
21
  export declare function tapFirst<T>(tap: (value: T) => void, skipFirst?: boolean): MonoTypeOperatorFunction<T>;
20
22
  /**
21
- * Prevents an observable from emitting complete until it is unsubscribed from.
23
+ * Wraps an observable so that it never emits `complete` until it is unsubscribed.
22
24
  *
23
- * The subscription will never have complete() called as complete only gets called after it unsubscribes,
24
- * so use finalize() if additional cleanup is required.
25
+ * The subscription will never have `complete()` called since it only triggers after unsubscription.
26
+ * Use `finalize()` for additional cleanup.
25
27
  *
26
- * @param obs
27
- * @returns
28
+ * @param obs - the source observable to wrap
29
+ * @returns an observable that only completes on unsubscription
28
30
  */
29
31
  export declare function preventComplete<T>(obs: Observable<T>): Observable<T>;
30
32
  /**
31
- * Similar to from, but uses a Getter to keeps the Observable cold until it is subscribed to, then calls the promise or observable.
33
+ * Creates a cold observable that defers execution of the getter until subscription, then shares the result.
34
+ *
35
+ * Unlike `from()`, the promise/observable is not created until the first subscriber connects.
32
36
  *
33
- * The result value of the promise or the latest value of the observable is shared.
37
+ * @example
38
+ * ```ts
39
+ * const data$ = lazyFrom(() => fetch('/api/data').then(r => r.json()));
40
+ * // The fetch is not called until data$ is subscribed to
41
+ * ```
34
42
  *
35
- * @param getter
36
- * @returns
43
+ * @param getter - factory that returns a Promise or Observable
44
+ * @returns a shared observable that defers execution until subscription
37
45
  */
38
46
  export declare function lazyFrom<T>(getter: Getter<Promise<T> | Observable<T>>): Observable<T>;
@@ -36,4 +36,21 @@ export interface ErrorOnEmissionsInPeriodConfig<T> {
36
36
  */
37
37
  readonly errorMessage?: string;
38
38
  }
39
+ /**
40
+ * RxJS operator that throws an error (or switches to an alternative observable) when too many
41
+ * emissions occur within a rolling time period.
42
+ *
43
+ * Useful as a safety valve to detect infinite loops or runaway observables.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * source$.pipe(
48
+ * errorOnEmissionsInPeriod({ maxEmissionsPerPeriod: 100, period: 1000 })
49
+ * ).subscribe();
50
+ * // throws if more than 100 emissions occur within 1 second
51
+ * ```
52
+ *
53
+ * @param config - period duration, max emissions, and error/fallback handling
54
+ * @returns an operator that monitors emission frequency
55
+ */
39
56
  export declare function errorOnEmissionsInPeriod<T>(config: ErrorOnEmissionsInPeriodConfig<T>): MonoTypeOperatorFunction<T>;
@@ -1,29 +1,57 @@
1
1
  import { type Observable, type OperatorFunction } from 'rxjs';
2
2
  import { type PrimativeKey, type ReadKeyFunction, type ReadMultipleKeysFunction } from '@dereekb/util';
3
3
  /**
4
- * Creates a map function that maps the input Map to an Observable that returns values mapped from the map's values.
4
+ * Creates a function that takes a `Map` and combines the latest emissions from observables
5
+ * created from each map value.
5
6
  *
6
- * @param mapToObs
7
- * @returns
7
+ * @param mapToObs - function to transform each map value into an observable
8
+ * @returns a function that converts a Map to a combined observable of results
8
9
  */
9
10
  export declare function combineLatestFromMapValuesObsFn<T, O>(mapToObs: (value: T) => Observable<O>): (map: Map<unknown, T>) => Observable<O[]>;
11
+ /**
12
+ * Creates a function that takes an array of values, maps each to an observable, and combines their latest emissions.
13
+ *
14
+ * Returns `of([])` for empty arrays.
15
+ *
16
+ * @param mapToObs - function to transform each value into an observable
17
+ * @returns a function that converts an array to a combined observable
18
+ */
10
19
  export declare function combineLatestFromArrayObsFn<T, O>(mapToObs: (value: T) => Observable<O>): (values: T[]) => Observable<O[]>;
11
20
  export type ObservableObjectMap = object;
12
21
  export type ObservableObjectMapResult<T extends ObservableObjectMap> = {
13
22
  [K in keyof T]: T[K] extends Observable<infer O> ? O : T[K];
14
23
  };
24
+ /**
25
+ * Combines the latest values from an object of observables into a single observable of resolved values.
26
+ *
27
+ * Each key in the input object maps to an observable (or static value). The result observable
28
+ * emits an object with the same keys, where each value is the latest emission from its source.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const result$ = combineLatestFromObject({
33
+ * name: of('Alice'),
34
+ * age: of(30)
35
+ * });
36
+ * // emits { name: 'Alice', age: 30 }
37
+ * ```
38
+ *
39
+ * @param objectMap - an object whose values are observables or static values
40
+ * @returns an observable that emits the resolved object
41
+ */
15
42
  export declare function combineLatestFromObject<T extends ObservableObjectMap>(objectMap: T): Observable<ObservableObjectMapResult<T>>;
16
43
  /**
17
- * Convenience function for creating a map() operator function using keyValueMapFactory().
44
+ * RxJS operator that maps an array of items to a `Map<K, T>` using the provided key reader.
18
45
  *
19
- * @param read
20
- * @returns
46
+ * @param read - function to extract the key from each item
47
+ * @returns an operator that converts an array into a keyed Map
21
48
  */
22
49
  export declare function keyValueMap<T, K extends PrimativeKey = PrimativeKey>(read: ReadKeyFunction<T, K>): OperatorFunction<T[], Map<K, T>>;
23
50
  /**
24
- * Convenience function for creating a map() operator function using multiKeyValueMapFactory().
51
+ * RxJS operator that maps an array of items to a `Map<K, T>` using a multi-key reader,
52
+ * allowing each item to appear under multiple keys.
25
53
  *
26
- * @param read
27
- * @returns
54
+ * @param read - function to extract multiple keys from each item
55
+ * @returns an operator that converts an array into a multi-keyed Map
28
56
  */
29
57
  export declare function multiKeyValueMap<T, K extends PrimativeKey = PrimativeKey>(read: ReadMultipleKeysFunction<T, K>): OperatorFunction<T[], Map<K, T>>;
@@ -1,9 +1,12 @@
1
1
  import { type FilterUniqueFunctionAdditionalKeysInput, type PrimativeKey, type ReadKeyFunction } from '@dereekb/util';
2
2
  import { type MonoTypeOperatorFunction } from 'rxjs';
3
3
  /**
4
- * Convenience function for building an OperatorFunction that uses filterUniqueFunction().
4
+ * RxJS operator that filters an array to unique items based on a key reader function.
5
5
  *
6
- * @param readKey
7
- * @param additionalKeys
6
+ * Uses {@link filterUniqueFunction} to deduplicate emitted arrays by extracting a key from each item.
7
+ *
8
+ * @param readKey - function to extract the unique key from each item
9
+ * @param additionalKeysInput - optional additional keys to include in the unique set
10
+ * @returns an operator that emits deduplicated arrays
8
11
  */
9
12
  export declare function filterUnique<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K>, additionalKeysInput?: FilterUniqueFunctionAdditionalKeysInput<T, K>): MonoTypeOperatorFunction<T[]>;
@@ -1,10 +1,44 @@
1
1
  import { type Maybe, type PrimativeKey, type ReadValueFunction, type EqualityComparatorFunction } from '@dereekb/util';
2
2
  import { type MonoTypeOperatorFunction, type Observable, type OperatorFunction } from 'rxjs';
3
+ /**
4
+ * RxJS operator that checks whether the emitted `Set` contains all values from the given observable.
5
+ *
6
+ * @param valuesObs - observable of values to check against
7
+ * @returns an operator that emits true if all values are contained in the set
8
+ */
3
9
  export declare function setContainsAllValuesFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
10
+ /**
11
+ * RxJS operator that checks whether the emitted `Set` contains any value from the given observable.
12
+ *
13
+ * @param valuesObs - observable of values to check against
14
+ * @returns an operator that emits true if any value is contained in the set
15
+ */
4
16
  export declare function setContainsAnyValueFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
17
+ /**
18
+ * RxJS operator that checks whether the emitted `Set` contains none of the values from the given observable.
19
+ *
20
+ * @param valuesObs - observable of values to check against
21
+ * @returns an operator that emits true if no values are contained in the set
22
+ */
5
23
  export declare function setContainsNoValueFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
24
+ /**
25
+ * `distinctUntilChanged` variant for iterables that only emits when the contained values change.
26
+ */
6
27
  export declare function distinctUntilHasDifferentValues<I extends Iterable<K>, K extends PrimativeKey>(): MonoTypeOperatorFunction<I>;
28
+ /**
29
+ * `distinctUntilChanged` variant that extracts iterable values from the emitted item and only emits
30
+ * when the set of extracted values changes.
31
+ *
32
+ * @param readValues - function to extract the iterable of values to compare
33
+ */
7
34
  export declare function distinctUntilItemsHaveDifferentValues<I, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<I, V>): MonoTypeOperatorFunction<I>;
8
35
  export declare function distinctUntilItemsHaveDifferentValues<I, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<I, V>): MonoTypeOperatorFunction<Maybe<I>>;
36
+ /**
37
+ * `distinctUntilChanged` variant that extracts values from the emitted item and compares them
38
+ * using a custom equality comparator.
39
+ *
40
+ * @param readValues - function to extract the value to compare
41
+ * @param isEqualComparator - custom equality function for the extracted values
42
+ */
9
43
  export declare function distinctUntilItemsValueChanges<I, V>(readValues: ReadValueFunction<I, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<I>;
10
44
  export declare function distinctUntilItemsValueChanges<I, V>(readValues: ReadValueFunction<I, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<Maybe<I>>;
@@ -8,6 +8,23 @@ export interface SearchStringFilterConfig<T> {
8
8
  readonly search$: Observable<Maybe<string>>;
9
9
  }
10
10
  /**
11
- * Uses a SearchStringFilterFunction to filter values.
11
+ * RxJS operator that filters an emitted array by a reactive search string.
12
+ *
13
+ * Combines the source array with the `search$` observable and applies the configured
14
+ * search string filter function. When the search is null/undefined, all items pass through.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const items$ = of(['apple', 'banana', 'cherry']);
19
+ * const search$ = new BehaviorSubject<string>('an');
20
+ *
21
+ * items$.pipe(
22
+ * filterWithSearchString({ filter: (x) => x, search$ })
23
+ * ).subscribe(console.log);
24
+ * // ['banana']
25
+ * ```
26
+ *
27
+ * @param config - search filter configuration with filter function and search$ observable
28
+ * @returns an operator that filters arrays by search string
12
29
  */
13
30
  export declare function filterWithSearchString<T>(config: SearchStringFilterConfig<T>): MonoTypeOperatorFunction<T[]>;
@@ -1,8 +1,28 @@
1
1
  import { type MonoTypeOperatorFunction } from 'rxjs';
2
2
  import { type Getter, type GetterOrValue } from '@dereekb/util';
3
3
  /**
4
- * Used to pass a default value incase an observable has not yet started emititng values.
4
+ * RxJS operator that emits a default value if the source does not emit within the specified timeout.
5
+ *
6
+ * After the timeout, the default value is prepended and the source continues normally.
7
+ *
8
+ * @param defaultValue - value or getter to use as the default
9
+ * @param first - timeout in ms before emitting the default (defaults to 0)
10
+ * @returns an operator that provides a fallback on slow emissions
5
11
  */
6
12
  export declare function timeoutStartWith<T>(defaultValue: GetterOrValue<T>, first?: number): MonoTypeOperatorFunction<T>;
13
+ /**
14
+ * RxJS operator that executes a side-effect function if the source does not emit within the given timeout.
15
+ *
16
+ * @param timeoutDelay - timeout in ms before triggering the side-effect
17
+ * @param useFn - side-effect function to call on timeout
18
+ * @returns an operator that taps after timeout
19
+ */
7
20
  export declare function tapAfterTimeout<T>(timeoutDelay: number, useFn: () => void): MonoTypeOperatorFunction<T>;
21
+ /**
22
+ * RxJS operator that throws an error if the source does not emit within the given timeout.
23
+ *
24
+ * @param timeoutDelay - timeout in ms before throwing
25
+ * @param error - getter that produces the error to throw
26
+ * @returns an operator that throws on timeout
27
+ */
8
28
  export declare function throwErrorAfterTimeout<T>(timeoutDelay: number, error: Getter<unknown>): MonoTypeOperatorFunction<T>;
@@ -1,7 +1,9 @@
1
1
  import { type Observable } from 'rxjs';
2
2
  /**
3
- * Convenience function to subscribe to the input observable and use the first value.
3
+ * Subscribes to the observable, calls the provided function with the first emitted value,
4
+ * then automatically unsubscribes.
4
5
  *
5
- * @param useFn
6
+ * @param obs - the source observable
7
+ * @param useFn - function to call with the first value
6
8
  */
7
9
  export declare function useFirst<T>(obs: Observable<T>, useFn: (value: T) => void): void;