@dereekb/rxjs 13.11.13 → 13.11.15
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 +478 -442
- package/index.esm.js +478 -442
- package/package.json +2 -2
- package/src/lib/asset/asset.builder.d.ts +14 -14
- package/src/lib/asset/asset.loader.d.ts +7 -7
- package/src/lib/asset/asset.loader.delegated.d.ts +3 -3
- package/src/lib/asset/asset.loader.fetch.d.ts +3 -3
- package/src/lib/asset/asset.loader.memory.d.ts +3 -3
- package/src/lib/filter/filter.map.d.ts +12 -12
- package/src/lib/filter/filter.preset.d.ts +5 -4
- package/src/lib/filter/filter.source.d.ts +4 -4
- package/src/lib/iterator/iteration.accumulator.d.ts +3 -4
- package/src/lib/iterator/iteration.accumulator.rxjs.d.ts +8 -8
- package/src/lib/iterator/iteration.mapped.d.ts +4 -4
- package/src/lib/iterator/iteration.mapped.page.d.ts +3 -3
- package/src/lib/iterator/iteration.next.d.ts +11 -13
- package/src/lib/iterator/iterator.page.d.ts +4 -4
- package/src/lib/loading/loading.context.rxjs.d.ts +2 -2
- package/src/lib/loading/loading.context.simple.d.ts +4 -4
- package/src/lib/loading/loading.context.state.d.ts +6 -6
- package/src/lib/loading/loading.context.state.list.d.ts +3 -3
- package/src/lib/loading/loading.state.d.ts +68 -68
- package/src/lib/loading/loading.state.list.d.ts +12 -12
- package/src/lib/loading/loading.state.rxjs.d.ts +18 -18
- package/src/lib/lock.d.ts +25 -25
- package/src/lib/object.d.ts +1 -1
- package/src/lib/rxjs/array.d.ts +7 -7
- package/src/lib/rxjs/boolean.d.ts +6 -6
- package/src/lib/rxjs/decision.d.ts +6 -6
- package/src/lib/rxjs/delta.d.ts +7 -7
- package/src/lib/rxjs/expires.d.ts +13 -13
- package/src/lib/rxjs/factory.d.ts +7 -7
- package/src/lib/rxjs/getter.d.ts +4 -4
- package/src/lib/rxjs/key.d.ts +4 -4
- package/src/lib/rxjs/lifecycle.d.ts +5 -5
- package/src/lib/rxjs/loading.d.ts +2 -2
- package/src/lib/rxjs/map.d.ts +3 -3
- package/src/lib/rxjs/misc.d.ts +6 -5
- package/src/lib/rxjs/model.d.ts +2 -2
- package/src/lib/rxjs/number.d.ts +4 -4
- package/src/lib/rxjs/rxjs.async.d.ts +5 -5
- package/src/lib/rxjs/rxjs.d.ts +12 -12
- package/src/lib/rxjs/rxjs.error.d.ts +3 -3
- package/src/lib/rxjs/rxjs.map.d.ts +11 -11
- package/src/lib/rxjs/rxjs.unique.d.ts +3 -3
- package/src/lib/rxjs/set.d.ts +12 -12
- package/src/lib/rxjs/string.d.ts +3 -3
- package/src/lib/rxjs/timeout.d.ts +9 -9
- package/src/lib/rxjs/use.d.ts +2 -2
- package/src/lib/rxjs/value.d.ts +49 -45
- package/src/lib/subscription.d.ts +7 -7
- package/src/lib/work/work.factory.d.ts +8 -6
- package/src/lib/work/work.instance.d.ts +9 -8
package/src/lib/rxjs/set.d.ts
CHANGED
|
@@ -3,44 +3,44 @@ import { type MonoTypeOperatorFunction, type Observable, type OperatorFunction }
|
|
|
3
3
|
/**
|
|
4
4
|
* RxJS operator that checks whether the emitted `Set` contains all values from the given observable.
|
|
5
5
|
*
|
|
6
|
-
* @param valuesObs -
|
|
7
|
-
* @returns
|
|
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
8
|
*/
|
|
9
9
|
export declare function setContainsAllValuesFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
|
|
10
10
|
/**
|
|
11
11
|
* RxJS operator that checks whether the emitted `Set` contains any value from the given observable.
|
|
12
12
|
*
|
|
13
|
-
* @param valuesObs -
|
|
14
|
-
* @returns
|
|
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
15
|
*/
|
|
16
16
|
export declare function setContainsAnyValueFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
|
|
17
17
|
/**
|
|
18
18
|
* RxJS operator that checks whether the emitted `Set` contains none of the values from the given observable.
|
|
19
19
|
*
|
|
20
|
-
* @param valuesObs -
|
|
21
|
-
* @returns
|
|
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
22
|
*/
|
|
23
23
|
export declare function setContainsNoValueFrom<T>(valuesObs: Observable<Maybe<Iterable<T>>>): OperatorFunction<Set<T>, boolean>;
|
|
24
24
|
/**
|
|
25
25
|
* `distinctUntilChanged` variant for iterables that only emits when the contained values change.
|
|
26
26
|
*
|
|
27
|
-
* @returns
|
|
27
|
+
* @returns Operator that suppresses consecutive iterable emissions with the same set of values.
|
|
28
28
|
*/
|
|
29
29
|
export declare function distinctUntilHasDifferentValues<I extends Iterable<K>, K extends PrimativeKey>(): MonoTypeOperatorFunction<I>;
|
|
30
30
|
/**
|
|
31
31
|
* `distinctUntilChanged` variant that extracts iterable values from the emitted item and only emits
|
|
32
32
|
* when the set of extracted values changes.
|
|
33
33
|
*
|
|
34
|
-
* @param readValues -
|
|
35
|
-
* @returns
|
|
34
|
+
* @param readValues - Function to extract the iterable of values to compare.
|
|
35
|
+
* @returns Operator that suppresses consecutive emissions whose extracted iterable values are the same.
|
|
36
36
|
*/
|
|
37
37
|
export declare function distinctUntilItemsHaveDifferentValues<I extends Maybe<unknown>, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<NonNullable<I>, V>): MonoTypeOperatorFunction<I>;
|
|
38
38
|
/**
|
|
39
39
|
* `distinctUntilChanged` variant that extracts values from the emitted item and compares them
|
|
40
40
|
* using a custom equality comparator.
|
|
41
41
|
*
|
|
42
|
-
* @param readValues -
|
|
43
|
-
* @param isEqualComparator -
|
|
44
|
-
* @returns
|
|
42
|
+
* @param readValues - Function to extract the value to compare.
|
|
43
|
+
* @param isEqualComparator - Custom equality function for the extracted values.
|
|
44
|
+
* @returns Operator that suppresses consecutive emissions whose extracted values are considered equal.
|
|
45
45
|
*/
|
|
46
46
|
export declare function distinctUntilItemsValueChanges<I extends Maybe<unknown>, V>(readValues: ReadValueFunction<NonNullable<I>, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<I>;
|
package/src/lib/rxjs/string.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export interface SearchStringFilterConfig<T> {
|
|
|
13
13
|
* Combines the source array with the `search$` observable and applies the configured
|
|
14
14
|
* search string filter function. When the search is null/undefined, all items pass through.
|
|
15
15
|
*
|
|
16
|
+
* @param config - Search filter configuration with filter function and search$ observable.
|
|
17
|
+
* @returns An operator that filters arrays by search string.
|
|
18
|
+
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```ts
|
|
18
21
|
* const items$ = of(['apple', 'banana', 'cherry']);
|
|
@@ -23,8 +26,5 @@ export interface SearchStringFilterConfig<T> {
|
|
|
23
26
|
* ).subscribe(console.log);
|
|
24
27
|
* // ['banana']
|
|
25
28
|
* ```
|
|
26
|
-
*
|
|
27
|
-
* @param config - search filter configuration with filter function and search$ observable
|
|
28
|
-
* @returns an operator that filters arrays by search string
|
|
29
29
|
*/
|
|
30
30
|
export declare function filterWithSearchString<T>(config: SearchStringFilterConfig<T>): MonoTypeOperatorFunction<T[]>;
|
|
@@ -5,24 +5,24 @@ import { type Getter, type GetterOrValue } from '@dereekb/util';
|
|
|
5
5
|
*
|
|
6
6
|
* After the timeout, the default value is prepended and the source continues normally.
|
|
7
7
|
*
|
|
8
|
-
* @param defaultValue -
|
|
9
|
-
* @param first -
|
|
10
|
-
* @returns
|
|
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.
|
|
11
11
|
*/
|
|
12
12
|
export declare function timeoutStartWith<T>(defaultValue: GetterOrValue<T>, first?: number): MonoTypeOperatorFunction<T>;
|
|
13
13
|
/**
|
|
14
14
|
* RxJS operator that executes a side-effect function if the source does not emit within the given timeout.
|
|
15
15
|
*
|
|
16
|
-
* @param timeoutDelay -
|
|
17
|
-
* @param useFn -
|
|
18
|
-
* @returns
|
|
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
19
|
*/
|
|
20
20
|
export declare function tapAfterTimeout<T>(timeoutDelay: number, useFn: () => void): MonoTypeOperatorFunction<T>;
|
|
21
21
|
/**
|
|
22
22
|
* RxJS operator that throws an error if the source does not emit within the given timeout.
|
|
23
23
|
*
|
|
24
|
-
* @param timeoutDelay -
|
|
25
|
-
* @param error -
|
|
26
|
-
* @returns
|
|
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
27
|
*/
|
|
28
28
|
export declare function throwErrorAfterTimeout<T>(timeoutDelay: number, error: Getter<unknown>): MonoTypeOperatorFunction<T>;
|
package/src/lib/rxjs/use.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Observable } from 'rxjs';
|
|
|
3
3
|
* Subscribes to the observable, calls the provided function with the first emitted value,
|
|
4
4
|
* then automatically unsubscribes.
|
|
5
5
|
*
|
|
6
|
-
* @param obs -
|
|
7
|
-
* @param useFn -
|
|
6
|
+
* @param obs - The source observable.
|
|
7
|
+
* @param useFn - Function to call with the first value.
|
|
8
8
|
*/
|
|
9
9
|
export declare function useFirst<T>(obs: Observable<T>, useFn: (value: T) => void): void;
|
package/src/lib/rxjs/value.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ export type IsModifiedFunction<T = unknown> = IsCheckFunction<T>;
|
|
|
21
21
|
/**
|
|
22
22
|
* Creates an {@link IsModifiedFunction} by inverting the result of an {@link IsEqualFunction}.
|
|
23
23
|
*
|
|
24
|
-
* @param isEqualFunction -
|
|
25
|
-
* @returns
|
|
24
|
+
* @param isEqualFunction - Equality check function to invert.
|
|
25
|
+
* @returns Predicate that reports true whenever the underlying equality check signals inequality.
|
|
26
|
+
*
|
|
26
27
|
* @__NO_SIDE_EFFECTS__
|
|
27
28
|
*/
|
|
28
29
|
export declare function makeIsModifiedFunction<T>(isEqualFunction: IsEqualFunction<T>): IsModifiedFunction<T>;
|
|
@@ -51,35 +52,38 @@ export interface MakeIsModifiedFunctionObservableConfig<T = unknown> {
|
|
|
51
52
|
* Prefers `isModified` over `isEqual` (which is inverted), falling back to `defaultFunction`
|
|
52
53
|
* or a function that always returns true.
|
|
53
54
|
*
|
|
54
|
-
* @param config -
|
|
55
|
-
* @returns
|
|
55
|
+
* @param config - Configuration with isModified, isEqual, and/or defaultFunction.
|
|
56
|
+
* @returns An observable of the resolved IsModifiedFunction.
|
|
57
|
+
*
|
|
56
58
|
* @__NO_SIDE_EFFECTS__
|
|
57
59
|
*/
|
|
58
60
|
export declare function makeIsModifiedFunctionObservable<T>(config: MakeIsModifiedFunctionObservableConfig<T>): Observable<IsModifiedFunction<T>>;
|
|
59
61
|
/**
|
|
60
62
|
* Creates a function that returns the value if the check function returns true, otherwise undefined.
|
|
61
63
|
*
|
|
62
|
-
* @param isCheckFunction -
|
|
63
|
-
* @param defaultValueOnMaybe -
|
|
64
|
-
* @returns
|
|
64
|
+
* @param isCheckFunction - Optional check function.
|
|
65
|
+
* @param defaultValueOnMaybe - Default result for null/undefined values.
|
|
66
|
+
* @returns Function that yields the input value when it passes the check, or undefined otherwise.
|
|
67
|
+
*
|
|
65
68
|
* @__NO_SIDE_EFFECTS__
|
|
66
69
|
*/
|
|
67
70
|
export declare function makeReturnIfIsFunction<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>, defaultValueOnMaybe?: boolean): (value: Maybe<T>) => Observable<Maybe<T>>;
|
|
68
71
|
/**
|
|
69
72
|
* Returns the value wrapped in an observable if the check function passes, otherwise emits undefined.
|
|
70
73
|
*
|
|
71
|
-
* @param isCheckFunction -
|
|
72
|
-
* @param value -
|
|
73
|
-
* @param defaultValueOnMaybe -
|
|
74
|
-
* @returns
|
|
74
|
+
* @param isCheckFunction - Optional check function.
|
|
75
|
+
* @param value - The value to check.
|
|
76
|
+
* @param defaultValueOnMaybe - Default result for null/undefined values.
|
|
77
|
+
* @returns An observable that emits the value if the check passes, or undefined otherwise.
|
|
75
78
|
*/
|
|
76
79
|
export declare function returnIfIs<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>, value: Maybe<T>, defaultValueOnMaybe?: boolean): Observable<Maybe<T>>;
|
|
77
80
|
/**
|
|
78
81
|
* Creates a function that checks a value against the check function and returns an observable boolean.
|
|
79
82
|
*
|
|
80
|
-
* @param isCheckFunction -
|
|
81
|
-
* @param defaultValueOnMaybe -
|
|
82
|
-
* @returns
|
|
83
|
+
* @param isCheckFunction - Optional check function.
|
|
84
|
+
* @param defaultValueOnMaybe - Default result for null/undefined values.
|
|
85
|
+
* @returns Function that emits whether the supplied value passes the check, falling back to the default for missing values.
|
|
86
|
+
*
|
|
83
87
|
* @__NO_SIDE_EFFECTS__
|
|
84
88
|
*/
|
|
85
89
|
export declare function makeCheckIsFunction<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>, defaultValueOnMaybe?: boolean): (value: Maybe<T>) => Observable<boolean>;
|
|
@@ -88,16 +92,16 @@ export declare function makeCheckIsFunction<T>(isCheckFunction: Maybe<IsModified
|
|
|
88
92
|
*
|
|
89
93
|
* Returns `of(true)` when no check function is provided.
|
|
90
94
|
*
|
|
91
|
-
* @param isCheckFunction -
|
|
92
|
-
* @param value -
|
|
93
|
-
* @param defaultValueOnMaybe -
|
|
94
|
-
* @returns
|
|
95
|
+
* @param isCheckFunction - Optional check function.
|
|
96
|
+
* @param value - The value to check.
|
|
97
|
+
* @param defaultValueOnMaybe - Default result for null/undefined values (defaults to false)
|
|
98
|
+
* @returns An observable boolean indicating whether the value passes the check.
|
|
95
99
|
*/
|
|
96
100
|
export declare function checkIs<T>(isCheckFunction: Maybe<IsModifiedFunction<T>>, value: Maybe<T>, defaultValueOnMaybe?: boolean): Observable<boolean>;
|
|
97
101
|
/**
|
|
98
102
|
* RxJS operator that filters out null and undefined values, only passing through defined values.
|
|
99
103
|
*
|
|
100
|
-
* @returns
|
|
104
|
+
* @returns Operator that filters out null and undefined emissions.
|
|
101
105
|
*/
|
|
102
106
|
export declare function filterMaybe<T>(): OperatorFunction<Maybe<T>, T>;
|
|
103
107
|
/**
|
|
@@ -107,33 +111,33 @@ export declare const filterMaybeStrict: <T>() => OperatorFunction<Maybe<T>, Mayb
|
|
|
107
111
|
/**
|
|
108
112
|
* RxJS operator that filters out null/undefined elements from an emitted array, keeping only defined values.
|
|
109
113
|
*
|
|
110
|
-
* @returns
|
|
114
|
+
* @returns Operator that maps each emitted array to a version with null/undefined elements removed.
|
|
111
115
|
*/
|
|
112
116
|
export declare function filterMaybeArray<T>(): OperatorFunction<Maybe<T>[], T[]>;
|
|
113
117
|
/**
|
|
114
118
|
* RxJS operator that skips all leading null/undefined emissions, then passes all subsequent values through.
|
|
115
119
|
*
|
|
116
|
-
* @returns
|
|
120
|
+
* @returns Operator that skips all null/undefined emissions at the start of the stream.
|
|
117
121
|
*/
|
|
118
122
|
export declare function skipAllInitialMaybe<T>(): MonoTypeOperatorFunction<T>;
|
|
119
123
|
/**
|
|
120
124
|
* RxJS operator that skips only the first emission if it is null/undefined, then passes all subsequent values.
|
|
121
125
|
*
|
|
122
|
-
* @returns
|
|
126
|
+
* @returns Operator that skips the first null/undefined emission if it occurs at the start of the stream.
|
|
123
127
|
*/
|
|
124
128
|
export declare function skipInitialMaybe<T>(): MonoTypeOperatorFunction<T>;
|
|
125
129
|
/**
|
|
126
130
|
* RxJS operator that skips up to `maxToSkip` null/undefined emissions, then passes all subsequent values.
|
|
127
131
|
*
|
|
128
|
-
* @param maxToSkip -
|
|
129
|
-
* @returns
|
|
132
|
+
* @param maxToSkip - Maximum number of null/undefined emissions to skip.
|
|
133
|
+
* @returns Operator that skips the first N null/undefined emissions from the stream.
|
|
130
134
|
*/
|
|
131
135
|
export declare function skipMaybes<T>(maxToSkip: number): MonoTypeOperatorFunction<T>;
|
|
132
136
|
/**
|
|
133
137
|
* RxJS operator that switches to the emitted observable if defined, or emits the default value if null/undefined.
|
|
134
138
|
*
|
|
135
|
-
* @param defaultValue -
|
|
136
|
-
* @returns
|
|
139
|
+
* @param defaultValue - Fallback value when the observable is nullish (defaults to undefined)
|
|
140
|
+
* @returns An operator that handles optional observables.
|
|
137
141
|
*/
|
|
138
142
|
export declare function switchMapMaybeDefault<T = unknown>(defaultValue?: Maybe<T>): OperatorFunction<Maybe<Observable<Maybe<T>>>, Maybe<T>>;
|
|
139
143
|
/**
|
|
@@ -158,8 +162,8 @@ export interface SwitchMapObjectConfig<T> {
|
|
|
158
162
|
* RxJS operator that resolves an observable/getter config input into a value, applying defaults
|
|
159
163
|
* for `null`/`undefined`/`true` inputs and emitting `null` for `false`.
|
|
160
164
|
*
|
|
161
|
-
* @param config -
|
|
162
|
-
* @returns
|
|
165
|
+
* @param config - Configuration providing an optional default getter for null/undefined/true inputs.
|
|
166
|
+
* @returns Operator that resolves each emitted getter into a value, using the default for nullish or true inputs.
|
|
163
167
|
*/
|
|
164
168
|
export declare function switchMapObject<T extends object>(config: SwitchMapObjectConfig<T>): OperatorFunction<Maybe<ObservableOrValueGetter<Maybe<T | boolean>>>, Maybe<T>>;
|
|
165
169
|
/**
|
|
@@ -200,36 +204,36 @@ export declare function switchMapOnBoolean<T = unknown>(switchOnValue: boolean,
|
|
|
200
204
|
*
|
|
201
205
|
* Combines {@link filterMaybe} and `switchMap` to only subscribe to non-nullish observables.
|
|
202
206
|
*
|
|
203
|
-
* @returns
|
|
207
|
+
* @returns Operator that filters nullish observables and subscribes to the non-nullish ones.
|
|
204
208
|
*/
|
|
205
209
|
export declare function switchMapFilterMaybe<T = unknown>(): OperatorFunction<Maybe<Observable<Maybe<T>>>, T>;
|
|
206
210
|
/**
|
|
207
211
|
* RxJS operator that switches to the emitted observable if defined, or emits `undefined` when the observable is nullish.
|
|
208
212
|
*
|
|
209
|
-
* @returns
|
|
213
|
+
* @returns Operator that switches to the emitted observable or emits undefined for null/undefined inputs.
|
|
210
214
|
*/
|
|
211
215
|
export declare function switchMapMaybe<T = unknown>(): OperatorFunction<Maybe<Observable<Maybe<T>>>, Maybe<T>>;
|
|
212
216
|
/**
|
|
213
217
|
* RxJS operator that applies a map function only when the emitted value is non-null/non-undefined.
|
|
214
218
|
*
|
|
215
|
-
* @param mapFn -
|
|
216
|
-
* @returns
|
|
219
|
+
* @param mapFn - Function to transform defined values.
|
|
220
|
+
* @returns An operator that maps defined values and passes through undefined.
|
|
217
221
|
*/
|
|
218
222
|
export declare function mapMaybe<A, B>(mapFn: MapFunction<A, Maybe<B>>): OperatorFunction<Maybe<A>, Maybe<B>>;
|
|
219
223
|
/**
|
|
220
224
|
* RxJS operator that applies a map function only when the decision function returns true.
|
|
221
225
|
*
|
|
222
|
-
* @param mapFn -
|
|
223
|
-
* @param decision -
|
|
224
|
-
* @returns
|
|
226
|
+
* @param mapFn - Function to transform the value.
|
|
227
|
+
* @param decision - Predicate that determines whether to apply the map.
|
|
228
|
+
* @returns An operator that conditionally maps values.
|
|
225
229
|
*/
|
|
226
230
|
export declare function mapIf<A, B>(mapFn: MapFunction<Maybe<A>, Maybe<B>>, decision: DecisionFunction<Maybe<A>>): OperatorFunction<Maybe<A>, Maybe<B>>;
|
|
227
231
|
/**
|
|
228
232
|
* Combines the source observable with another observable via `combineLatest`, then maps the pair to a result.
|
|
229
233
|
*
|
|
230
|
-
* @param combineObs -
|
|
231
|
-
* @param mapFn -
|
|
232
|
-
* @returns
|
|
234
|
+
* @param combineObs - The secondary observable to combine with the source.
|
|
235
|
+
* @param mapFn - Function that maps the source value and combined value to the output.
|
|
236
|
+
* @returns Operator that combines the source with `combineObs` and maps each pair using `mapFn`
|
|
233
237
|
*/
|
|
234
238
|
export declare function combineLatestMapFrom<A, B, C>(combineObs: Observable<B>, mapFn: (a: A, b: B) => C): OperatorFunction<A, C>;
|
|
235
239
|
/**
|
|
@@ -237,17 +241,17 @@ export declare function combineLatestMapFrom<A, B, C>(combineObs: Observable<B>,
|
|
|
237
241
|
*
|
|
238
242
|
* If the delay is not provided, or is falsy, then the second value is never emitted.
|
|
239
243
|
*
|
|
240
|
-
* @param startWith -
|
|
241
|
-
* @param endWith -
|
|
242
|
-
* @param delayTime -
|
|
243
|
-
* @returns
|
|
244
|
+
* @param startWith - The value to emit immediately.
|
|
245
|
+
* @param endWith - The value to emit after the delay.
|
|
246
|
+
* @param delayTime - Optional delay in milliseconds before emitting the second value.
|
|
247
|
+
* @returns An observable that emits `startWith` immediately and `endWith` after the delay (if provided)
|
|
244
248
|
*/
|
|
245
249
|
export declare function emitDelayObs<T>(startWith: T, endWith: T, delayTime: Maybe<Milliseconds>): Observable<T>;
|
|
246
250
|
/**
|
|
247
251
|
* Emits a value after a given delay after every new emission.
|
|
248
252
|
*
|
|
249
|
-
* @param value -
|
|
250
|
-
* @param delayTime -
|
|
251
|
-
* @returns
|
|
253
|
+
* @param value - The value to emit after the delay.
|
|
254
|
+
* @param delayTime - Duration in milliseconds before emitting the value.
|
|
255
|
+
* @returns Operator that appends the given value after each source emission with the specified delay.
|
|
252
256
|
*/
|
|
253
257
|
export declare function emitAfterDelay<T>(value: T, delayTime: Milliseconds): MonoTypeOperatorFunction<T>;
|
|
@@ -21,13 +21,13 @@ import { type ArrayOrValue, type Destroyable, type Maybe } from '@dereekb/util';
|
|
|
21
21
|
export declare class SubscriptionObject<T extends Unsubscribable = Unsubscribable> implements Destroyable {
|
|
22
22
|
private _subscription?;
|
|
23
23
|
/**
|
|
24
|
-
* @param sub -
|
|
24
|
+
* @param sub - Optional initial subscription to manage.
|
|
25
25
|
*/
|
|
26
26
|
constructor(sub?: Maybe<T>);
|
|
27
27
|
/**
|
|
28
28
|
* Whether a subscription is currently being managed.
|
|
29
29
|
*
|
|
30
|
-
* @returns
|
|
30
|
+
* @returns True if a subscription is currently active.
|
|
31
31
|
*/
|
|
32
32
|
get hasSubscription(): boolean;
|
|
33
33
|
/**
|
|
@@ -37,7 +37,7 @@ export declare class SubscriptionObject<T extends Unsubscribable = Unsubscribabl
|
|
|
37
37
|
/**
|
|
38
38
|
* Replaces the current subscription with the given one, unsubscribing from the previous.
|
|
39
39
|
*
|
|
40
|
-
* @param sub -
|
|
40
|
+
* @param sub - New subscription to manage, or `undefined`/`void` to just unsubscribe.
|
|
41
41
|
*/
|
|
42
42
|
setSub(sub: Maybe<T | void>): void;
|
|
43
43
|
/**
|
|
@@ -74,13 +74,13 @@ export declare class SubscriptionObject<T extends Unsubscribable = Unsubscribabl
|
|
|
74
74
|
export declare class MultiSubscriptionObject<T extends Unsubscribable = Unsubscribable> implements Destroyable {
|
|
75
75
|
private _subscriptions?;
|
|
76
76
|
/**
|
|
77
|
-
* @param subs -
|
|
77
|
+
* @param subs - Optional initial subscription(s) to manage.
|
|
78
78
|
*/
|
|
79
79
|
constructor(subs?: ArrayOrValue<T>);
|
|
80
80
|
/**
|
|
81
81
|
* Whether any subscriptions are currently being managed.
|
|
82
82
|
*
|
|
83
|
-
* @returns
|
|
83
|
+
* @returns True if one or more subscriptions are currently active.
|
|
84
84
|
*/
|
|
85
85
|
get hasSubscription(): boolean;
|
|
86
86
|
/**
|
|
@@ -90,13 +90,13 @@ export declare class MultiSubscriptionObject<T extends Unsubscribable = Unsubscr
|
|
|
90
90
|
/**
|
|
91
91
|
* Replaces all managed subscriptions with the given ones, unsubscribing from all previous.
|
|
92
92
|
*
|
|
93
|
-
* @param subs -
|
|
93
|
+
* @param subs - New subscription(s) to manage.
|
|
94
94
|
*/
|
|
95
95
|
setSubs(subs: ArrayOrValue<T>): void;
|
|
96
96
|
/**
|
|
97
97
|
* Adds subscription(s) to the managed set without affecting existing ones. Duplicate subscriptions are ignored.
|
|
98
98
|
*
|
|
99
|
-
* @param subs -
|
|
99
|
+
* @param subs - Subscription(s) to add.
|
|
100
100
|
*/
|
|
101
101
|
addSubs(subs: ArrayOrValue<T>): void;
|
|
102
102
|
/**
|
|
@@ -40,6 +40,11 @@ export interface WorkFactoryConfig<T, O> {
|
|
|
40
40
|
* If the work function returns an observable, it is automatically subscribed to. If it uses
|
|
41
41
|
* the handler directly, the observable return is ignored.
|
|
42
42
|
*
|
|
43
|
+
* @param config - Work function and delegate configuration.
|
|
44
|
+
* @param config.work - The work function to execute for each input value.
|
|
45
|
+
* @param config.delegate - Delegate that receives lifecycle callbacks (start, success, reject)
|
|
46
|
+
* @returns A factory function that creates WorkInstance for each input.
|
|
47
|
+
*
|
|
43
48
|
* @example
|
|
44
49
|
* ```ts
|
|
45
50
|
* const factory = workFactory({
|
|
@@ -51,10 +56,6 @@ export interface WorkFactoryConfig<T, O> {
|
|
|
51
56
|
* // instance tracks the work lifecycle
|
|
52
57
|
* ```
|
|
53
58
|
*
|
|
54
|
-
* @param config - work function and delegate configuration
|
|
55
|
-
* @param config.work - the work function to execute for each input value
|
|
56
|
-
* @param config.delegate - delegate that receives lifecycle callbacks (start, success, reject)
|
|
57
|
-
* @returns a factory function that creates WorkInstance for each input
|
|
58
59
|
* @__NO_SIDE_EFFECTS__
|
|
59
60
|
*/
|
|
60
61
|
export declare function workFactory<T, O>({ work, delegate }: WorkFactoryConfig<T, O>): WorkFactory<T, O>;
|
|
@@ -67,8 +68,9 @@ export type WorkFactoryConfigFactory<T, O> = FactoryWithRequiredInput<WorkFactor
|
|
|
67
68
|
* Creates a {@link WorkFactory} that generates a new {@link WorkFactoryConfig} for each input,
|
|
68
69
|
* enabling dynamic work and delegate selection per invocation.
|
|
69
70
|
*
|
|
70
|
-
* @param configFactory -
|
|
71
|
-
* @returns
|
|
71
|
+
* @param configFactory - Factory that produces work configuration from the input value.
|
|
72
|
+
* @returns A work factory with per-invocation configuration.
|
|
73
|
+
*
|
|
72
74
|
* @__NO_SIDE_EFFECTS__
|
|
73
75
|
*/
|
|
74
76
|
export declare function workFactoryForConfigFactory<T, O>(configFactory: WorkFactoryConfigFactory<T, O>): WorkFactory<T, O>;
|
|
@@ -61,7 +61,7 @@ export declare class WorkInstance<I = unknown, O = unknown> implements Destroyab
|
|
|
61
61
|
*
|
|
62
62
|
* If the loading state returns an error, the error is forwarded.
|
|
63
63
|
*
|
|
64
|
-
* @param loadingStateObs -
|
|
64
|
+
* @param loadingStateObs - Observable of the loading state to track as the work result.
|
|
65
65
|
*/
|
|
66
66
|
startWorkingWithLoadingStateObservable(loadingStateObs: Observable<Maybe<LoadingState<O>>>): void;
|
|
67
67
|
/**
|
|
@@ -71,8 +71,8 @@ export declare class WorkInstance<I = unknown, O = unknown> implements Destroyab
|
|
|
71
71
|
*
|
|
72
72
|
* It is used in conjunction with startWorking() and ideal for cases where multiple observables or promises are used.
|
|
73
73
|
*
|
|
74
|
-
* @param loadingStateObs -
|
|
75
|
-
* @returns
|
|
74
|
+
* @param loadingStateObs - Promise or observable of the loading state to track for errors.
|
|
75
|
+
* @returns Resolves with the first non-loading value, or rejects when the loading state surfaces an error.
|
|
76
76
|
*/
|
|
77
77
|
performTaskWithLoadingState<T>(loadingStateObs: Promise<LoadingState<T>> | Observable<Maybe<LoadingState<T>>>): Promise<T>;
|
|
78
78
|
/**
|
|
@@ -80,19 +80,20 @@ export declare class WorkInstance<I = unknown, O = unknown> implements Destroyab
|
|
|
80
80
|
*
|
|
81
81
|
* If an error is thrown, the error is forwarded to the reject function.
|
|
82
82
|
*
|
|
83
|
-
* @param fn -
|
|
83
|
+
* @param fn - Synchronous function that returns the result value or throws an error.
|
|
84
|
+
* @throws Re-throws the error from `fn` after forwarding it to the reject function.
|
|
84
85
|
*/
|
|
85
86
|
performTaskWithReturnValue(fn: () => O): void;
|
|
86
87
|
/**
|
|
87
88
|
* Begins working using a promise.
|
|
88
89
|
*
|
|
89
|
-
* @param promise -
|
|
90
|
+
* @param promise - Asynchronous work whose resolved value should be tracked as the work result.
|
|
90
91
|
*/
|
|
91
92
|
startWorkingWithPromise(promise: Promise<O>): void;
|
|
92
93
|
/**
|
|
93
94
|
* Begins working using an observable.
|
|
94
95
|
*
|
|
95
|
-
* @param workObs -
|
|
96
|
+
* @param workObs - The observable that represents the asynchronous work and emits the result.
|
|
96
97
|
*/
|
|
97
98
|
startWorkingWithObservable(workObs: Observable<O>): void;
|
|
98
99
|
/**
|
|
@@ -102,13 +103,13 @@ export declare class WorkInstance<I = unknown, O = unknown> implements Destroyab
|
|
|
102
103
|
/**
|
|
103
104
|
* Sets success on the work.
|
|
104
105
|
*
|
|
105
|
-
* @param result -
|
|
106
|
+
* @param result - The successful result value to pass to the delegate.
|
|
106
107
|
*/
|
|
107
108
|
success(result?: O): void;
|
|
108
109
|
/**
|
|
109
110
|
* Sets rejected on the work.
|
|
110
111
|
*
|
|
111
|
-
* @param error -
|
|
112
|
+
* @param error - The error to pass to the delegate as the rejection reason.
|
|
112
113
|
*/
|
|
113
114
|
reject(error?: ErrorInput): void;
|
|
114
115
|
destroy(): void;
|