@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.
Files changed (53) hide show
  1. package/index.cjs.js +478 -442
  2. package/index.esm.js +478 -442
  3. package/package.json +2 -2
  4. package/src/lib/asset/asset.builder.d.ts +14 -14
  5. package/src/lib/asset/asset.loader.d.ts +7 -7
  6. package/src/lib/asset/asset.loader.delegated.d.ts +3 -3
  7. package/src/lib/asset/asset.loader.fetch.d.ts +3 -3
  8. package/src/lib/asset/asset.loader.memory.d.ts +3 -3
  9. package/src/lib/filter/filter.map.d.ts +12 -12
  10. package/src/lib/filter/filter.preset.d.ts +5 -4
  11. package/src/lib/filter/filter.source.d.ts +4 -4
  12. package/src/lib/iterator/iteration.accumulator.d.ts +3 -4
  13. package/src/lib/iterator/iteration.accumulator.rxjs.d.ts +8 -8
  14. package/src/lib/iterator/iteration.mapped.d.ts +4 -4
  15. package/src/lib/iterator/iteration.mapped.page.d.ts +3 -3
  16. package/src/lib/iterator/iteration.next.d.ts +11 -13
  17. package/src/lib/iterator/iterator.page.d.ts +4 -4
  18. package/src/lib/loading/loading.context.rxjs.d.ts +2 -2
  19. package/src/lib/loading/loading.context.simple.d.ts +4 -4
  20. package/src/lib/loading/loading.context.state.d.ts +6 -6
  21. package/src/lib/loading/loading.context.state.list.d.ts +3 -3
  22. package/src/lib/loading/loading.state.d.ts +68 -68
  23. package/src/lib/loading/loading.state.list.d.ts +12 -12
  24. package/src/lib/loading/loading.state.rxjs.d.ts +18 -18
  25. package/src/lib/lock.d.ts +25 -25
  26. package/src/lib/object.d.ts +1 -1
  27. package/src/lib/rxjs/array.d.ts +7 -7
  28. package/src/lib/rxjs/boolean.d.ts +6 -6
  29. package/src/lib/rxjs/decision.d.ts +6 -6
  30. package/src/lib/rxjs/delta.d.ts +7 -7
  31. package/src/lib/rxjs/expires.d.ts +13 -13
  32. package/src/lib/rxjs/factory.d.ts +7 -7
  33. package/src/lib/rxjs/getter.d.ts +4 -4
  34. package/src/lib/rxjs/key.d.ts +4 -4
  35. package/src/lib/rxjs/lifecycle.d.ts +5 -5
  36. package/src/lib/rxjs/loading.d.ts +2 -2
  37. package/src/lib/rxjs/map.d.ts +3 -3
  38. package/src/lib/rxjs/misc.d.ts +6 -5
  39. package/src/lib/rxjs/model.d.ts +2 -2
  40. package/src/lib/rxjs/number.d.ts +4 -4
  41. package/src/lib/rxjs/rxjs.async.d.ts +5 -5
  42. package/src/lib/rxjs/rxjs.d.ts +12 -12
  43. package/src/lib/rxjs/rxjs.error.d.ts +3 -3
  44. package/src/lib/rxjs/rxjs.map.d.ts +11 -11
  45. package/src/lib/rxjs/rxjs.unique.d.ts +3 -3
  46. package/src/lib/rxjs/set.d.ts +12 -12
  47. package/src/lib/rxjs/string.d.ts +3 -3
  48. package/src/lib/rxjs/timeout.d.ts +9 -9
  49. package/src/lib/rxjs/use.d.ts +2 -2
  50. package/src/lib/rxjs/value.d.ts +49 -45
  51. package/src/lib/subscription.d.ts +7 -7
  52. package/src/lib/work/work.factory.d.ts +8 -6
  53. package/src/lib/work/work.instance.d.ts +9 -8
@@ -22,6 +22,10 @@ export interface LoadingErrorPair {
22
22
  /**
23
23
  * Compares two {@link LoadingState} instances for shallow equality across all key properties.
24
24
  *
25
+ * @param a - First loading state.
26
+ * @param b - Second loading state.
27
+ * @returns True if loading, loadingProgress, error, and value are all strictly equal.
28
+ *
25
29
  * @example
26
30
  * ```ts
27
31
  * const a = successResult('hello');
@@ -31,10 +35,6 @@ export interface LoadingErrorPair {
31
35
  * const c = beginLoading();
32
36
  * isLoadingStateEqual(a, c); // false
33
37
  * ```
34
- *
35
- * @param a - first loading state
36
- * @param b - second loading state
37
- * @returns true if loading, loadingProgress, error, and value are all strictly equal
38
38
  */
39
39
  export declare function isLoadingStateEqual<T extends LoadingState>(a: T, b: T): boolean;
40
40
  /**
@@ -43,9 +43,9 @@ export declare function isLoadingStateEqual<T extends LoadingState>(a: T, b: T):
43
43
  *
44
44
  * Does not compare the `value` property — only structural metadata.
45
45
  *
46
- * @param a - first loading error pair
47
- * @param b - second loading error pair
48
- * @returns true if both pairs have equivalent metadata
46
+ * @param a - First loading error pair.
47
+ * @param b - Second loading error pair.
48
+ * @returns True if both pairs have equivalent metadata.
49
49
  */
50
50
  export declare function isLoadingStateMetadataEqual(a: Partial<LoadingErrorPair>, b: Partial<LoadingErrorPair>): boolean;
51
51
  /**
@@ -133,6 +133,9 @@ export declare enum LoadingStateType {
133
133
  * Returns `LOADING` if still loading, `SUCCESS` if finished with a value key,
134
134
  * `ERROR` if finished with an error key, or `IDLE` if finished with neither.
135
135
  *
136
+ * @param loadingState - The loading state to classify.
137
+ * @returns The corresponding {@link LoadingStateType}
138
+ *
136
139
  * @example
137
140
  * ```ts
138
141
  * loadingStateType(beginLoading()); // LoadingStateType.LOADING
@@ -140,9 +143,6 @@ export declare enum LoadingStateType {
140
143
  * loadingStateType(errorResult(new Error())); // LoadingStateType.ERROR
141
144
  * loadingStateType({ loading: false }); // LoadingStateType.IDLE
142
145
  * ```
143
- *
144
- * @param loadingState - the loading state to classify
145
- * @returns the corresponding {@link LoadingStateType}
146
146
  */
147
147
  export declare function loadingStateType(loadingState: LoadingState): LoadingStateType;
148
148
  /**
@@ -151,6 +151,9 @@ export declare function loadingStateType(loadingState: LoadingState): LoadingSta
151
151
  * Returns `true` when `loading` is explicitly `false`, or when `loading` is not `true`
152
152
  * and either a value, error, or `null` value is present.
153
153
  *
154
+ * @param state - The loading state to check (may be null/undefined)
155
+ * @returns True if loading is complete.
156
+ *
154
157
  * @example
155
158
  * ```ts
156
159
  * isLoadingStateFinishedLoading(successResult('done')); // true
@@ -158,9 +161,6 @@ export declare function loadingStateType(loadingState: LoadingState): LoadingSta
158
161
  * isLoadingStateFinishedLoading({ loading: false }); // true
159
162
  * isLoadingStateFinishedLoading(null); // false
160
163
  * ```
161
- *
162
- * @param state - the loading state to check (may be null/undefined)
163
- * @returns true if loading is complete
164
164
  */
165
165
  export declare function isLoadingStateFinishedLoading<L extends LoadingState>(state: Maybe<L>): boolean;
166
166
  /**
@@ -168,14 +168,14 @@ export declare function isLoadingStateFinishedLoading<L extends LoadingState>(st
168
168
  *
169
169
  * Represents a state where no loading has been initiated yet.
170
170
  *
171
+ * @returns A loading state with `loading: false` and no value or error.
172
+ *
171
173
  * @example
172
174
  * ```ts
173
175
  * const state = idleLoadingState();
174
176
  * // { loading: false }
175
177
  * loadingStateType(state); // LoadingStateType.IDLE
176
178
  * ```
177
- *
178
- * @returns a loading state with `loading: false` and no value or error
179
179
  */
180
180
  export declare function idleLoadingState<T>(): LoadingState<T>;
181
181
  /**
@@ -199,30 +199,30 @@ export declare function beginLoading<T>(state?: Partial<LoadingState<T>>): Loadi
199
199
  /**
200
200
  * Creates a {@link PageLoadingState} that is loading for the given page number.
201
201
  *
202
- * @param page - the page number being loaded
203
- * @param state - optional partial state to merge
204
- * @returns a page loading state with `loading: true`
202
+ * @param page - The page number being loaded.
203
+ * @param state - Optional partial state to merge.
204
+ * @returns A page loading state with `loading: true`
205
205
  */
206
206
  export declare function beginLoadingPage<T>(page: PageNumber, state?: Partial<PageLoadingState<T>>): PageLoadingState<T>;
207
207
  /**
208
208
  * Creates a successful {@link LoadingState} with the given value and `loading: false`.
209
209
  *
210
+ * @param value - The loaded value.
211
+ * @returns A loading state representing a successful result.
212
+ *
210
213
  * @example
211
214
  * ```ts
212
215
  * const state = successResult({ name: 'Alice' });
213
216
  * // { value: { name: 'Alice' }, loading: false }
214
217
  * ```
215
- *
216
- * @param value - the loaded value
217
- * @returns a loading state representing a successful result
218
218
  */
219
219
  export declare function successResult<T>(value: T): LoadingStateWithValue<T>;
220
220
  /**
221
221
  * Creates a successful {@link PageLoadingState} for a specific page.
222
222
  *
223
- * @param page - the page number
224
- * @param value - the loaded value
225
- * @returns a page loading state representing success
223
+ * @param page - The page number.
224
+ * @param value - The loaded value.
225
+ * @returns A page loading state representing success.
226
226
  */
227
227
  export declare function successPageResult<T>(page: PageNumber, value: T): PageLoadingState<T>;
228
228
  /**
@@ -230,48 +230,48 @@ export declare function successPageResult<T>(page: PageNumber, value: T): PageLo
230
230
  *
231
231
  * Converts the input error to a {@link ReadableError} via {@link toReadableError}.
232
232
  *
233
+ * @param error - The error to wrap (string, Error, or ReadableError)
234
+ * @returns A loading state representing an error.
235
+ *
233
236
  * @example
234
237
  * ```ts
235
238
  * const state = errorResult(new Error('Not found'));
236
239
  * // { error: { message: 'Not found', ... }, loading: false }
237
240
  * ```
238
- *
239
- * @param error - the error to wrap (string, Error, or ReadableError)
240
- * @returns a loading state representing an error
241
241
  */
242
242
  export declare function errorResult<T>(error?: Maybe<ErrorInput>): LoadingState<T>;
243
243
  /**
244
244
  * Creates a {@link PageLoadingState} representing an error for a specific page.
245
245
  *
246
- * @param page - the page number
247
- * @param error - the error to include
248
- * @returns a page loading state representing an error
246
+ * @param page - The page number.
247
+ * @param error - The error to include.
248
+ * @returns A page loading state representing an error.
249
249
  */
250
250
  export declare function errorPageResult<T>(page: PageNumber, error?: Maybe<ReadableError | ReadableDataError>): PageLoadingState<T>;
251
251
  /**
252
252
  * Whether any of the given {@link LoadingState} instances are currently loading.
253
253
  *
254
+ * @param states - Array of loading states to check.
255
+ * @returns True if at least one state is loading.
256
+ *
254
257
  * @example
255
258
  * ```ts
256
259
  * isAnyLoadingStateInLoadingState([successResult(1), beginLoading()]); // true
257
260
  * isAnyLoadingStateInLoadingState([successResult(1), successResult(2)]); // false
258
261
  * ```
259
- *
260
- * @param states - array of loading states to check
261
- * @returns true if at least one state is loading
262
262
  */
263
263
  export declare function isAnyLoadingStateInLoadingState(states: LoadingState[]): boolean;
264
264
  /**
265
265
  * Whether all given {@link LoadingState} instances have finished loading.
266
266
  *
267
+ * @param states - Array of loading states to check.
268
+ * @returns True if every state has finished loading.
269
+ *
267
270
  * @example
268
271
  * ```ts
269
272
  * areAllLoadingStatesFinishedLoading([successResult(1), successResult(2)]); // true
270
273
  * areAllLoadingStatesFinishedLoading([successResult(1), beginLoading()]); // false
271
274
  * ```
272
- *
273
- * @param states - array of loading states to check
274
- * @returns true if every state has finished loading
275
275
  */
276
276
  export declare function areAllLoadingStatesFinishedLoading(states: LoadingState[]): boolean;
277
277
  /**
@@ -279,8 +279,8 @@ export declare function areAllLoadingStatesFinishedLoading(states: LoadingState[
279
279
  *
280
280
  * When the target type is `IDLE`, returns `true` for null/undefined states.
281
281
  *
282
- * @param type - the loading state type to match against
283
- * @returns a predicate function for the given type
282
+ * @param type - The loading state type to match against.
283
+ * @returns A predicate function for the given type.
284
284
  */
285
285
  export declare function isLoadingStateWithStateType(type: LoadingStateType): <L extends LoadingState>(state: Maybe<L>) => boolean;
286
286
  /**
@@ -318,42 +318,42 @@ export declare const isLoadingStateInErrorState: <L extends LoadingState>(state:
318
318
  /**
319
319
  * Type guard that checks whether a {@link LoadingState} has a non-undefined value, regardless of loading status.
320
320
  *
321
+ * @param state - The loading state to check.
322
+ * @returns True if the state has a defined (non-undefined) value.
323
+ *
321
324
  * @example
322
325
  * ```ts
323
326
  * isLoadingStateWithDefinedValue(successResult('hello')); // true
324
327
  * isLoadingStateWithDefinedValue(successResult(null)); // true (null is defined)
325
328
  * isLoadingStateWithDefinedValue(beginLoading()); // false
326
329
  * ```
327
- *
328
- * @param state - the loading state to check
329
- * @returns true if the state has a defined (non-undefined) value
330
330
  */
331
331
  export declare function isLoadingStateWithDefinedValue<L extends LoadingState>(state: Maybe<L> | LoadingStateWithDefinedValue<LoadingStateValue<L>>): state is LoadingStateWithDefinedValue<LoadingStateValue<L>>;
332
332
  /**
333
333
  * Type guard that checks whether a {@link LoadingState} has a non-null error, regardless of loading status.
334
334
  *
335
+ * @param state - The loading state to check.
336
+ * @returns True if the state has an error.
337
+ *
335
338
  * @example
336
339
  * ```ts
337
340
  * isLoadingStateWithError(errorResult(new Error('fail'))); // true
338
341
  * isLoadingStateWithError(successResult('ok')); // false
339
342
  * ```
340
- *
341
- * @param state - the loading state to check
342
- * @returns true if the state has an error
343
343
  */
344
344
  export declare function isLoadingStateWithError<L extends LoadingState>(state: Maybe<L> | LoadingState<LoadingStateValue<L>>): state is LoadingStateWithError<LoadingStateValue<L>>;
345
345
  /**
346
346
  * Type guard that checks whether a {@link LoadingState} has finished loading and has a defined value.
347
347
  *
348
- * @param state - the loading state to check
349
- * @returns true if finished loading with a non-undefined value
348
+ * @param state - The loading state to check.
349
+ * @returns True if finished loading with a non-undefined value.
350
350
  */
351
351
  export declare function isLoadingStateFinishedLoadingWithDefinedValue<L extends LoadingState>(state: Maybe<L> | LoadingStateWithDefinedValue<LoadingStateValue<L>>): state is LoadingStateWithDefinedValue<LoadingStateValue<L>>;
352
352
  /**
353
353
  * Type guard that checks whether a {@link LoadingState} has finished loading and has an error.
354
354
  *
355
- * @param state - the loading state to check
356
- * @returns true if finished loading with an error
355
+ * @param state - The loading state to check.
356
+ * @returns True if finished loading with an error.
357
357
  */
358
358
  export declare function isLoadingStateFinishedLoadingWithError<L extends LoadingState>(state: Maybe<L> | LoadingState<LoadingStateValue<L>>): state is LoadingStateWithError<LoadingStateValue<L>>;
359
359
  /**
@@ -361,6 +361,10 @@ export declare function isLoadingStateFinishedLoadingWithError<L extends Loading
361
361
  *
362
362
  * Does not compare values — only structural metadata.
363
363
  *
364
+ * @param a - First page loading state.
365
+ * @param b - Second page loading state.
366
+ * @returns True if metadata is equivalent.
367
+ *
364
368
  * @example
365
369
  * ```ts
366
370
  * isPageLoadingStateMetadataEqual(
@@ -373,10 +377,6 @@ export declare function isLoadingStateFinishedLoadingWithError<L extends Loading
373
377
  * { page: 2 }
374
378
  * ); // false
375
379
  * ```
376
- *
377
- * @param a - first page loading state
378
- * @param b - second page loading state
379
- * @returns true if metadata is equivalent
380
380
  */
381
381
  export declare function isPageLoadingStateMetadataEqual(a: Partial<PageLoadingState>, b: Partial<PageLoadingState>): boolean;
382
382
  /**
@@ -426,25 +426,25 @@ export declare function mergeLoadingStates<O>(...args: any[]): LoadingState<O>;
426
426
  *
427
427
  * Useful for resetting a state back to loading or idle without losing other metadata (e.g., page).
428
428
  *
429
- * @param state - the state to copy metadata from
430
- * @param loading - whether to mark as loading (defaults to true)
431
- * @returns a new state with value/error cleared
429
+ * @param state - The state to copy metadata from.
430
+ * @param loading - Whether to mark as loading (defaults to true)
431
+ * @returns A new state with value/error cleared.
432
432
  */
433
433
  export declare function mergeLoadingStateWithLoading<S extends LoadingState>(state: S, loading?: boolean): S;
434
434
  /**
435
435
  * Returns a copy of the state with the given value, `loading: false`, and error cleared.
436
436
  *
437
- * @param state - the state to copy metadata from
438
- * @param value - the new value to set
439
- * @returns a new state representing success
437
+ * @param state - The state to copy metadata from.
438
+ * @param value - The new value to set.
439
+ * @returns A new state representing success.
440
440
  */
441
441
  export declare function mergeLoadingStateWithValue<S extends LoadingState>(state: S, value: LoadingStateValue<S> | undefined): S;
442
442
  /**
443
443
  * Returns a copy of the state with the given error and `loading: false`.
444
444
  *
445
- * @param state - the state to copy metadata from
446
- * @param error - the error to set
447
- * @returns a new state representing an error
445
+ * @param state - The state to copy metadata from.
446
+ * @param error - The error to set.
447
+ * @returns A new state representing an error.
448
448
  */
449
449
  export declare function mergeLoadingStateWithError<S extends LoadingState = LoadingState>(state: S, error?: ReadableDataError): S;
450
450
  export type MapMultipleLoadingStateValuesFn<T, X> = (input: X[]) => T;
@@ -457,10 +457,9 @@ export interface MapMultipleLoadingStateResultsConfiguration<T, X, L extends Loa
457
457
  *
458
458
  * Returns `undefined` if any input is still loading or has an error.
459
459
  *
460
- * @param input - array of loading states to combine
461
- * @param config - mapping configuration with either `mapValues` or `mapState`
462
- * @returns the combined loading state, or undefined if inputs are not ready
463
- *
460
+ * @param input - Array of loading states to combine.
461
+ * @param config - Mapping configuration with either `mapValues` or `mapState`
462
+ * @returns The combined loading state, or undefined if inputs are not ready.
464
463
  * @throws {Error} When neither `mapValues` nor `mapState` is provided in the config.
465
464
  */
466
465
  export declare function mapMultipleLoadingStateResults<T, X, L extends LoadingState<X>[], R extends LoadingState<T>>(input: L, config: MapMultipleLoadingStateResultsConfiguration<T, X, L, R>): Maybe<R>;
@@ -489,8 +488,8 @@ export interface MapLoadingStateResultsConfiguration<A, B, L extends LoadingStat
489
488
  * @param config - mapping configuration
490
489
  * @returns the transformed loading state
491
490
  */
492
- export declare function mapLoadingStateResults<A, B, L extends LoadingState<A> = LoadingState<A>, O extends LoadingState<B> = LoadingState<B>>(input: L, config: MapLoadingStateResultsConfiguration<A, B, L, O>): O;
493
491
  export declare function mapLoadingStateResults<A, B, L extends PageLoadingState<A> = PageLoadingState<A>, O extends PageLoadingState<B> = PageLoadingState<B>>(input: L, config: MapLoadingStateResultsConfiguration<A, B, L, O>): O;
492
+ export declare function mapLoadingStateResults<A, B, L extends LoadingState<A> = LoadingState<A>, O extends LoadingState<B> = LoadingState<B>>(input: L, config: MapLoadingStateResultsConfiguration<A, B, L, O>): O;
494
493
  export declare function mapLoadingStateResults<A, B, L extends Partial<PageLoadingState<A>> = Partial<PageLoadingState<A>>, O extends Partial<PageLoadingState<B>> = Partial<PageLoadingState<B>>>(input: L, config: MapLoadingStateResultsConfiguration<A, B, L, O>): O;
495
494
  export type MapLoadingStateValueFunction<O, I, L extends LoadingState<I> = LoadingState<I>> = MapFunction<L, Maybe<O>>;
496
495
  export type MapLoadingStateValueMapFunction<O, I, L extends LoadingState<I> = LoadingState<I>> = (item: I, state: L) => Maybe<O>;
@@ -498,8 +497,9 @@ export type MapLoadingStateValueMapFunction<O, I, L extends LoadingState<I> = Lo
498
497
  * Creates a function that extracts and maps the value from a {@link LoadingState}, returning undefined
499
498
  * when the state has no value.
500
499
  *
501
- * @param mapFn - function to transform the value and state into the output type
502
- * @returns a function that accepts a loading state and returns the mapped value or undefined
500
+ * @param mapFn - Function to transform the value and state into the output type.
501
+ * @returns Mapper that yields the transformed value when present, or undefined when the state has none.
502
+ *
503
503
  * @__NO_SIDE_EFFECTS__
504
504
  */
505
505
  export declare function mapLoadingStateValueFunction<O, I, L extends LoadingState<I> = LoadingState<I>>(mapFn: MapLoadingStateValueMapFunction<O, I, L>): MapLoadingStateValueFunction<O, I, L>;
@@ -6,28 +6,28 @@ import { type LoadingStateValue, type ListLoadingState, type PageLoadingState }
6
6
  *
7
7
  * Returns true if the value is nullish or has zero length, regardless of loading status.
8
8
  *
9
+ * @param listLoadingState - The list loading state to check.
10
+ * @returns True if the value is empty or absent.
11
+ *
9
12
  * @example
10
13
  * ```ts
11
14
  * isListLoadingStateWithEmptyValue(successResult([])); // true
12
15
  * isListLoadingStateWithEmptyValue(successResult([1, 2])); // false
13
16
  * isListLoadingStateWithEmptyValue(beginLoading()); // true (no value)
14
17
  * ```
15
- *
16
- * @param listLoadingState - the list loading state to check
17
- * @returns true if the value is empty or absent
18
18
  */
19
19
  export declare function isListLoadingStateWithEmptyValue<T>(listLoadingState: ListLoadingState<T>): boolean;
20
20
  /**
21
21
  * RxJS operator that maps each emitted {@link ListLoadingState} to a boolean indicating whether the list is empty.
22
22
  *
23
+ * @returns An operator that emits true when the list value is empty or absent.
24
+ *
23
25
  * @example
24
26
  * ```ts
25
27
  * of(successResult([])).pipe(
26
28
  * mapIsListLoadingStateWithEmptyValue()
27
29
  * ).subscribe((isEmpty) => console.log(isEmpty)); // true
28
30
  * ```
29
- *
30
- * @returns an operator that emits true when the list value is empty or absent
31
31
  */
32
32
  export declare function mapIsListLoadingStateWithEmptyValue<T>(): OperatorFunction<ListLoadingState<T>, boolean>;
33
33
  /**
@@ -35,16 +35,16 @@ export declare function mapIsListLoadingStateWithEmptyValue<T>(): OperatorFuncti
35
35
  *
36
36
  * Uses {@link loadingStateFromObs} internally and attaches the page number to each emitted state.
37
37
  *
38
+ * @param obs - The source observable to wrap.
39
+ * @param firstOnly - If true, only takes the first value.
40
+ * @param page - The page number to attach (defaults to 0)
41
+ * @returns An observable of page loading states.
42
+ *
38
43
  * @example
39
44
  * ```ts
40
45
  * const pageState$ = pageLoadingStateFromObs(fetchItems$, false, 2);
41
46
  * // emits: { loading: true, page: 2 }, then { value: items, loading: false, page: 2 }
42
47
  * ```
43
- *
44
- * @param obs - the source observable to wrap
45
- * @param firstOnly - if true, only takes the first value
46
- * @param page - the page number to attach (defaults to 0)
47
- * @returns an observable of page loading states
48
48
  */
49
49
  export declare function pageLoadingStateFromObs<T>(obs: Observable<T>, firstOnly?: boolean, page?: PageNumber): Observable<PageLoadingState<T>>;
50
50
  /**
@@ -53,6 +53,8 @@ export declare function pageLoadingStateFromObs<T>(obs: Observable<T>, firstOnly
53
53
  *
54
54
  * Combines {@link valueFromFinishedLoadingState} with a default of `[]`.
55
55
  *
56
+ * @returns An operator that emits the array value or an empty array.
57
+ *
56
58
  * @example
57
59
  * ```ts
58
60
  * of(successResult([1, 2, 3])).pipe(
@@ -63,7 +65,5 @@ export declare function pageLoadingStateFromObs<T>(obs: Observable<T>, firstOnly
63
65
  * arrayValueFromFinishedLoadingState()
64
66
  * ).subscribe((items) => console.log(items)); // []
65
67
  * ```
66
- *
67
- * @returns an operator that emits the array value or an empty array
68
68
  */
69
69
  export declare function arrayValueFromFinishedLoadingState<L extends ListLoadingState>(): OperatorFunction<L, LoadingStateValue<L>>;
@@ -9,6 +9,10 @@ import { type LoadingState, type PageLoadingState, type MapLoadingStateResultsCo
9
9
  *
10
10
  * If firstOnly is provided, it will only take the first value the observable returns.
11
11
  *
12
+ * @param obs - The source observable to wrap.
13
+ * @param firstOnly - If true, only takes the first value from the observable.
14
+ * @returns An observable that emits {@link LoadingState} values representing the loading lifecycle.
15
+ *
12
16
  * @example
13
17
  * ```ts
14
18
  * // Wrap a data fetch observable into a LoadingState
@@ -17,10 +21,6 @@ import { type LoadingState, type PageLoadingState, type MapLoadingStateResultsCo
17
21
  * // Wrap an observable and only take the first emitted value
18
22
  * readonly singleValueState$ = loadingStateFromObs(this.data$, true);
19
23
  * ```
20
- *
21
- * @param obs - The source observable to wrap.
22
- * @param firstOnly - If true, only takes the first value from the observable.
23
- * @returns An observable that emits {@link LoadingState} values representing the loading lifecycle.
24
24
  */
25
25
  export declare function loadingStateFromObs<T>(obs: Observable<T>, firstOnly?: boolean): Observable<LoadingState<T>>;
26
26
  /**
@@ -68,6 +68,9 @@ export declare function combineLoadingStates<O>(...args: any[]): Observable<Load
68
68
  * If any source has an error, the error is propagated. If any source is still loading, the result is loading.
69
69
  * When all sources are successful, the result value is `true`.
70
70
  *
71
+ * @param sources - LoadingState observables whose statuses participate in the combined emission.
72
+ * @returns An observable emitting a {@link LoadingState}<boolean> representing the combined status.
73
+ *
71
74
  * @example
72
75
  * ```ts
73
76
  * const success$ = of(successResult(1));
@@ -80,9 +83,6 @@ export declare function combineLoadingStates<O>(...args: any[]): Observable<Load
80
83
  * const loading$ = of(beginLoading());
81
84
  * const status$ = combineLoadingStatesStatus([loading$, success$]);
82
85
  * ```
83
- *
84
- * @param sources - An array of LoadingState observables to combine.
85
- * @returns An observable emitting a {@link LoadingState}<boolean> representing the combined status.
86
86
  */
87
87
  export declare function combineLoadingStatesStatus<A extends readonly LoadingState<any>[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<LoadingState<boolean>>;
88
88
  /**
@@ -122,6 +122,8 @@ export declare function startWithBeginLoading<L extends PageLoadingState>(state?
122
122
  *
123
123
  * Unlike {@link valueFromLoadingState}, this operator emits for every state change, regardless of whether the value is defined.
124
124
  *
125
+ * @returns An `OperatorFunction` that maps each {@link LoadingState} to its current value (or undefined).
126
+ *
125
127
  * @example
126
128
  * ```ts
127
129
  * // Expose the current (possibly undefined) value from a loading state
@@ -130,8 +132,6 @@ export declare function startWithBeginLoading<L extends PageLoadingState>(state?
130
132
  * shareReplay(1)
131
133
  * );
132
134
  * ```
133
- *
134
- * @returns An `OperatorFunction` that maps each {@link LoadingState} to its current value (or undefined).
135
135
  */
136
136
  export declare function currentValueFromLoadingState<L extends LoadingState>(): OperatorFunction<L, Maybe<LoadingStateValue<L>>>;
137
137
  /**
@@ -140,6 +140,8 @@ export declare function currentValueFromLoadingState<L extends LoadingState>():
140
140
  * Equivalent to piping {@link currentValueFromLoadingState} and `filterMaybeStrict()`.
141
141
  * Only emits when the value is defined, filtering out loading and error states without values.
142
142
  *
143
+ * @returns An `OperatorFunction` that emits only defined values from the {@link LoadingState}.
144
+ *
143
145
  * @example
144
146
  * ```ts
145
147
  * // Only emit when the loading state has a defined value
@@ -148,8 +150,6 @@ export declare function currentValueFromLoadingState<L extends LoadingState>():
148
150
  * // only emits non-null/non-undefined values
149
151
  * );
150
152
  * ```
151
- *
152
- * @returns An `OperatorFunction` that emits only defined values from the {@link LoadingState}.
153
153
  */
154
154
  export declare function valueFromLoadingState<L extends LoadingStateWithDefinedValue>(): OperatorFunction<L, MaybeSoStrict<LoadingStateValue<L>>>;
155
155
  /**
@@ -157,6 +157,8 @@ export declare function valueFromLoadingState<L extends LoadingStateWithDefinedV
157
157
  *
158
158
  * Filters to only emit when the state contains an error, then extracts and emits the {@link ReadableError}.
159
159
  *
160
+ * @returns An `OperatorFunction` that emits the {@link ReadableError} from error states.
161
+ *
160
162
  * @example
161
163
  * ```ts
162
164
  * // React to errors from a loading state
@@ -165,8 +167,6 @@ export declare function valueFromLoadingState<L extends LoadingStateWithDefinedV
165
167
  * tap((error) => console.error('Loading failed:', error))
166
168
  * ).subscribe();
167
169
  * ```
168
- *
169
- * @returns An `OperatorFunction` that emits the {@link ReadableError} from error states.
170
170
  */
171
171
  export declare function errorFromLoadingState<L extends LoadingState>(): OperatorFunction<L, ReadableError>;
172
172
  /**
@@ -175,6 +175,8 @@ export declare function errorFromLoadingState<L extends LoadingState>(): Operato
175
175
  * Passes through non-error states unchanged, but throws the error from any {@link LoadingStateWithError},
176
176
  * converting the loading state error into an observable error that can be caught with `catchError`.
177
177
  *
178
+ * @returns An `OperatorFunction` that passes through non-error states and throws on error states.
179
+ *
178
180
  * @example
179
181
  * ```ts
180
182
  * // Convert a LoadingState observable to a Promise, throwing on error states
@@ -185,8 +187,6 @@ export declare function errorFromLoadingState<L extends LoadingState>(): Operato
185
187
  * )
186
188
  * );
187
189
  * ```
188
- *
189
- * @returns An `OperatorFunction` that passes through non-error states and throws on error states.
190
190
  */
191
191
  export declare function throwErrorFromLoadingStateError<L extends LoadingState>(): OperatorFunction<L, L>;
192
192
  /**
@@ -402,6 +402,9 @@ export declare function distinctLoadingState<L extends Partial<PageLoadingState>
402
402
  * Waits for the first finished loading state, then resolves with the value. If the finished state
403
403
  * contains an error, the promise is rejected with that error.
404
404
  *
405
+ * @param obs - The observable emitting {@link LoadingState} values.
406
+ * @returns Resolves with the first finished value or rejects when the finished state carries an error.
407
+ *
405
408
  * @example
406
409
  * ```ts
407
410
  * // Await a loading state observable as a promise
@@ -418,8 +421,5 @@ export declare function distinctLoadingState<L extends Partial<PageLoadingState>
418
421
  * throw e;
419
422
  * });
420
423
  * ```
421
- *
422
- * @param obs - The observable emitting {@link LoadingState} values.
423
- * @returns A Promise that resolves with the value or rejects with the error.
424
424
  */
425
425
  export declare function promiseFromLoadingState<T>(obs: Observable<LoadingState<T>>): Promise<T>;
package/src/lib/lock.d.ts CHANGED
@@ -64,12 +64,12 @@ export declare const DEFAULT_LOCK_SET_TIME_LOCK_KEY = "timelock";
64
64
  *
65
65
  * Useful for deferring an action until all locks are released, with a safety timeout to avoid waiting indefinitely.
66
66
  *
67
- * @param config - configuration specifying the lock set, callback, timeout, and optional delay
68
- * @param config.lockSet - the lock set to monitor for the next unlock event
69
- * @param config.fn - optional callback to invoke when the lock set unlocks or the timeout is reached
70
- * @param config.timeout - maximum time in milliseconds to wait before timing out
71
- * @param config.delayTime - optional delay in milliseconds after unlock before invoking the callback
72
- * @returns subscription that can be unsubscribed to cancel the wait
67
+ * @param config - Configuration specifying the lock set, callback, timeout, and optional delay.
68
+ * @param config.lockSet - The lock set to monitor for the next unlock event.
69
+ * @param config.fn - Optional callback to invoke when the lock set unlocks or the timeout is reached.
70
+ * @param config.timeout - Maximum time in milliseconds to wait before timing out.
71
+ * @param config.delayTime - Optional delay in milliseconds after unlock before invoking the callback.
72
+ * @returns Subscription that can be unsubscribed to cancel the wait.
73
73
  *
74
74
  * @example
75
75
  * ```ts
@@ -139,32 +139,32 @@ export declare class LockSet implements Destroyable {
139
139
  * When locked with a duration, the lock automatically releases after the specified time.
140
140
  * When unlocked, the lock is removed from the set.
141
141
  *
142
- * @param key - identifier for this lock
143
- * @param config - locked state or configuration object
144
- * @param duration - optional auto-unlock duration in milliseconds (only used with boolean config)
142
+ * @param key - Identifier for this lock.
143
+ * @param config - Locked state or configuration object.
144
+ * @param duration - Optional auto-unlock duration in milliseconds (only used with boolean config)
145
145
  */
146
146
  setLocked(key: LockKey, config: SetLockedConfig): void;
147
147
  setLocked(key: LockKey, config: boolean, duration?: Milliseconds): void;
148
148
  /**
149
149
  * Locks for a specified number of seconds using the default time lock key.
150
150
  *
151
- * @param seconds - duration in seconds
151
+ * @param seconds - Duration in seconds.
152
152
  */
153
153
  lockForSeconds(seconds: Seconds): void;
154
154
  /**
155
155
  * Locks for a specified duration in milliseconds, automatically unlocking when the time elapses.
156
156
  *
157
- * @param milliseconds - lock duration
158
- * @param key - optional lock key, defaults to {@link DEFAULT_LOCK_SET_TIME_LOCK_KEY}
157
+ * @param milliseconds - Lock duration.
158
+ * @param key - Optional lock key, defaults to {@link DEFAULT_LOCK_SET_TIME_LOCK_KEY}
159
159
  */
160
160
  lockForTime(milliseconds: Milliseconds, key?: LockKey): void;
161
161
  /**
162
162
  * Registers a lock observable under the given key. The lock is considered active when
163
163
  * the observable emits `true`. Empty observables are treated as unlocked.
164
164
  *
165
- * @param key - identifier for this lock
166
- * @param obs - observable that emits the lock state
167
- * @returns function that removes this specific lock when called
165
+ * @param key - Identifier for this lock.
166
+ * @param obs - Observable that emits the lock state.
167
+ * @returns Function that removes this specific lock when called.
168
168
  *
169
169
  * @example
170
170
  * ```ts
@@ -180,30 +180,30 @@ export declare class LockSet implements Destroyable {
180
180
  /**
181
181
  * Removes the lock registered under the given key, if it exists.
182
182
  *
183
- * @param key - identifier of the lock to remove
183
+ * @param key - Identifier of the lock to remove.
184
184
  */
185
185
  removeLock(key: LockKey): void;
186
186
  /**
187
187
  * Registers a callback for the next time this lock set becomes unlocked.
188
188
  *
189
- * @param config - callback function or configuration object
190
- * @param delayTime - optional delay in milliseconds after unlock before invoking the callback
191
- * @returns subscription that can be unsubscribed to cancel the wait
189
+ * @param config - Callback function or configuration object.
190
+ * @param delayTime - Optional delay in milliseconds after unlock before invoking the callback.
191
+ * @returns Subscription that can be unsubscribed to cancel the wait.
192
192
  */
193
193
  onNextUnlock(config: OnLockSetUnlockedFunction | Omit<OnLockSetUnlockedConfig, 'lockSet'>, delayTime?: Milliseconds): Subscription;
194
194
  /**
195
195
  * Establishes a parent-child relationship where this lock set's locked state is propagated
196
196
  * to the parent. When this lock set is locked, the parent will also reflect a locked state.
197
197
  *
198
- * @param parent - parent lock set or observable of one; pass `undefined` to detach
198
+ * @param parent - Parent lock set or observable of one; pass `undefined` to detach.
199
199
  */
200
200
  setParentLockSet(parent: ObservableOrValue<Maybe<LockSet>>): void;
201
201
  /**
202
202
  * Registers a child lock set so its locked state propagates upward to this lock set.
203
203
  *
204
- * @param lockSet - child lock set to monitor
205
- * @param key - optional lock key, auto-generated if not provided
206
- * @returns function that removes the child lock relationship when called
204
+ * @param lockSet - Child lock set to monitor.
205
+ * @param key - Optional lock key, auto-generated if not provided.
206
+ * @returns Function that removes the child lock relationship when called.
207
207
  */
208
208
  addChildLockSet(lockSet: LockSet, key?: LockKey): RemoveLockFunction;
209
209
  get isDestroyed(): boolean;
@@ -213,8 +213,8 @@ export declare class LockSet implements Destroyable {
213
213
  * After the unlock event (or timeout), the optional callback is invoked and then
214
214
  * {@link destroy} is called after a short delay.
215
215
  *
216
- * @param config - optional callback or configuration for the unlock wait
217
- * @param delayTime - optional delay in milliseconds after unlock before invoking the callback
216
+ * @param config - Optional callback or configuration for the unlock wait.
217
+ * @param delayTime - Optional delay in milliseconds after unlock before invoking the callback.
218
218
  */
219
219
  destroyOnNextUnlock(config?: Maybe<DestroyOnNextUnlockConfig['fn'] | DestroyOnNextUnlockConfig>, delayTime?: Milliseconds): void;
220
220
  /**
@@ -5,7 +5,7 @@ import { type MonoTypeOperatorFunction, type Observable } from 'rxjs';
5
5
  * Uses {@link areEqualPOJOValues} for comparison, so the emitted objects should be plain objects
6
6
  * or compatible with deep value equality checks.
7
7
  *
8
- * @returns operator that filters out consecutive duplicate POJO emissions
8
+ * @returns Operator that filters out consecutive duplicate POJO emissions.
9
9
  *
10
10
  * @example
11
11
  * ```ts