@dereekb/rxjs 13.11.14 → 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/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/rxjs",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.15",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"rxjs": "^7.8.2",
|
|
7
|
-
"@dereekb/util": "13.11.
|
|
7
|
+
"@dereekb/util": "13.11.15"
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
"./package.json": "./package.json",
|
|
@@ -3,14 +3,14 @@ import { type AssetLocalPathRef, type AssetRemotePathRef } from './asset';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a local {@link AssetLocalPathRef}.
|
|
5
5
|
*
|
|
6
|
+
* @param path - Relative path from the environment's base asset directory.
|
|
7
|
+
* @returns A local asset reference with the given path.
|
|
8
|
+
*
|
|
6
9
|
* @example
|
|
7
10
|
* ```ts
|
|
8
11
|
* const DISTRICTS = localAsset('data/school-districts.json');
|
|
9
12
|
* // { sourceType: 'local', path: 'data/school-districts.json' }
|
|
10
13
|
* ```
|
|
11
|
-
*
|
|
12
|
-
* @param path - Relative path from the environment's base asset directory.
|
|
13
|
-
* @returns A local asset reference with the given path.
|
|
14
14
|
*/
|
|
15
15
|
export declare function localAsset(path: SlashPath): AssetLocalPathRef;
|
|
16
16
|
/**
|
|
@@ -19,15 +19,15 @@ export declare function localAsset(path: SlashPath): AssetLocalPathRef;
|
|
|
19
19
|
* Remote assets always use absolute URLs with an http:// or https:// prefix.
|
|
20
20
|
* Throws if the provided URL does not have a valid prefix.
|
|
21
21
|
*
|
|
22
|
+
* @param url - Absolute URL with http/https prefix to fetch the asset from.
|
|
23
|
+
* @returns A remote asset reference with the given URL.
|
|
24
|
+
* @throws {Error} If the URL does not have a valid http/https prefix.
|
|
25
|
+
*
|
|
22
26
|
* @example
|
|
23
27
|
* ```ts
|
|
24
28
|
* const CDN = remoteAsset('https://cdn.example.com/geo.json');
|
|
25
29
|
* // { sourceType: 'remote', url: 'https://cdn.example.com/geo.json' }
|
|
26
30
|
* ```
|
|
27
|
-
*
|
|
28
|
-
* @param url - Absolute URL with http/https prefix to fetch the asset from.
|
|
29
|
-
* @returns A remote asset reference with the given URL.
|
|
30
|
-
* @throws Error if the URL does not have a valid http/https prefix.
|
|
31
31
|
*/
|
|
32
32
|
export declare function remoteAsset(url: WebsiteUrlWithPrefix): AssetRemotePathRef;
|
|
33
33
|
/**
|
|
@@ -52,6 +52,9 @@ export interface AssetFolderBuilder {
|
|
|
52
52
|
* Creates a fluent builder for creating multiple local asset refs
|
|
53
53
|
* from the same folder.
|
|
54
54
|
*
|
|
55
|
+
* @param folder - Base folder path for the assets.
|
|
56
|
+
* @returns A fluent builder for creating local asset refs within the specified folder.
|
|
57
|
+
*
|
|
55
58
|
* @example
|
|
56
59
|
* ```ts
|
|
57
60
|
* const DATA = assetFolder('data');
|
|
@@ -65,9 +68,6 @@ export interface AssetFolderBuilder {
|
|
|
65
68
|
* // { sourceType: 'local', path: 'data/b.txt' }
|
|
66
69
|
* // ]
|
|
67
70
|
* ```
|
|
68
|
-
*
|
|
69
|
-
* @param folder - Base folder path for the assets.
|
|
70
|
-
* @returns A fluent builder for creating local asset refs within the specified folder.
|
|
71
71
|
*/
|
|
72
72
|
export declare function assetFolder(folder: SlashPath): AssetFolderBuilder;
|
|
73
73
|
/**
|
|
@@ -95,6 +95,10 @@ export interface RemoteAssetBuilder {
|
|
|
95
95
|
* The base URL must be a valid {@link WebsiteUrlWithPrefix}.
|
|
96
96
|
* Each child path is appended to produce a full absolute URL.
|
|
97
97
|
*
|
|
98
|
+
* @param baseUrl - Base URL with http/https prefix.
|
|
99
|
+
* @returns A fluent builder for creating remote asset refs under the specified base URL.
|
|
100
|
+
* @throws {Error} If the base URL does not have a valid http/https prefix.
|
|
101
|
+
*
|
|
98
102
|
* @example
|
|
99
103
|
* ```ts
|
|
100
104
|
* const CDN = remoteAssetBaseUrl('https://cdn.example.com/assets');
|
|
@@ -108,9 +112,5 @@ export interface RemoteAssetBuilder {
|
|
|
108
112
|
* // { sourceType: 'remote', url: 'https://cdn.example.com/assets/b.json' }
|
|
109
113
|
* // ]
|
|
110
114
|
* ```
|
|
111
|
-
*
|
|
112
|
-
* @param baseUrl - Base URL with http/https prefix.
|
|
113
|
-
* @returns A fluent builder for creating remote asset refs under the specified base URL.
|
|
114
|
-
* @throws Error if the base URL does not have a valid http/https prefix.
|
|
115
115
|
*/
|
|
116
116
|
export declare function remoteAssetBaseUrl(baseUrl: WebsiteUrlWithPrefix): RemoteAssetBuilder;
|
|
@@ -5,15 +5,15 @@ import { type AssetPathRef, type AssetLoaderAssetInstance, type AssetLoaderGetFn
|
|
|
5
5
|
* The returned {@link AssetLoaderAssetInstance.load} observable is cold — each subscription
|
|
6
6
|
* invokes the get function anew.
|
|
7
7
|
*
|
|
8
|
+
* @param ref - The asset path reference this instance represents.
|
|
9
|
+
* @param getFn - Promise-based function that loads the asset bytes.
|
|
10
|
+
* @returns An {@link AssetLoaderAssetInstance} with a cold observable that invokes getFn on each subscription.
|
|
11
|
+
*
|
|
8
12
|
* @example
|
|
9
13
|
* ```ts
|
|
10
14
|
* const instance = assetLoaderAssetInstance(ref, (r) => fetch(r.path).then(res => res.arrayBuffer()));
|
|
11
15
|
* instance.load().subscribe((data) => { ... });
|
|
12
16
|
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param ref - The asset path reference this instance represents.
|
|
15
|
-
* @param getFn - Promise-based function that loads the asset bytes.
|
|
16
|
-
* @returns An {@link AssetLoaderAssetInstance} with a cold observable that invokes getFn on each subscription.
|
|
17
17
|
*/
|
|
18
18
|
export declare function assetLoaderAssetInstance(ref: AssetPathRef, getFn: AssetLoaderGetFn): AssetLoaderAssetInstance;
|
|
19
19
|
/**
|
|
@@ -22,6 +22,9 @@ export declare function assetLoaderAssetInstance(ref: AssetPathRef, getFn: Asset
|
|
|
22
22
|
* This is the primary helper for building functional AssetLoader implementations
|
|
23
23
|
* from a Promise-based leaf loader.
|
|
24
24
|
*
|
|
25
|
+
* @param getFn - Promise-based function that loads any asset's bytes.
|
|
26
|
+
* @returns An {@link AssetLoader} that creates instances using the provided get function.
|
|
27
|
+
*
|
|
25
28
|
* @example
|
|
26
29
|
* ```ts
|
|
27
30
|
* const loader = assetLoaderFromGetFn(async (ref) => {
|
|
@@ -29,8 +32,5 @@ export declare function assetLoaderAssetInstance(ref: AssetPathRef, getFn: Asset
|
|
|
29
32
|
* return response.arrayBuffer();
|
|
30
33
|
* });
|
|
31
34
|
* ```
|
|
32
|
-
*
|
|
33
|
-
* @param getFn - Promise-based function that loads any asset's bytes.
|
|
34
|
-
* @returns An {@link AssetLoader} that creates instances using the provided get function.
|
|
35
35
|
*/
|
|
36
36
|
export declare function assetLoaderFromGetFn(getFn: AssetLoaderGetFn): AssetLoader;
|
|
@@ -20,6 +20,9 @@ export interface DelegatedAssetLoaderConfig {
|
|
|
20
20
|
* loader together, and the delegated loader routes each {@link AssetPathRef}
|
|
21
21
|
* to the correct one based on {@link AssetPathRef.sourceType}.
|
|
22
22
|
*
|
|
23
|
+
* @param config - Specifies the local and remote delegate loaders.
|
|
24
|
+
* @returns An {@link AssetLoader} that routes requests to the appropriate delegate based on source type.
|
|
25
|
+
*
|
|
23
26
|
* @example
|
|
24
27
|
* ```ts
|
|
25
28
|
* const loader = delegatedAssetLoader({
|
|
@@ -30,8 +33,5 @@ export interface DelegatedAssetLoaderConfig {
|
|
|
30
33
|
* loader.get(localAsset('data/districts.json')); // → local loader
|
|
31
34
|
* loader.get(remoteAsset('data/geo.json')); // → remote loader
|
|
32
35
|
* ```
|
|
33
|
-
*
|
|
34
|
-
* @param config - Specifies the local and remote delegate loaders.
|
|
35
|
-
* @returns An {@link AssetLoader} that routes requests to the appropriate delegate based on source type.
|
|
36
36
|
*/
|
|
37
37
|
export declare function delegatedAssetLoader(config: DelegatedAssetLoaderConfig): AssetLoader;
|
|
@@ -17,6 +17,9 @@ export interface FetchAssetLoaderConfig {
|
|
|
17
17
|
*
|
|
18
18
|
* Remote refs always have absolute URLs, so no base URL resolution is needed.
|
|
19
19
|
*
|
|
20
|
+
* @param config - Optional fetch configuration with custom fetch function.
|
|
21
|
+
* @returns An {@link AssetLoader} that loads remote assets via HTTP fetch.
|
|
22
|
+
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```ts
|
|
22
25
|
* const loader = fetchAssetLoader();
|
|
@@ -27,8 +30,5 @@ export interface FetchAssetLoaderConfig {
|
|
|
27
30
|
* // With a custom fetch function:
|
|
28
31
|
* const loader = fetchAssetLoader({ fetch: myAuthenticatedFetch });
|
|
29
32
|
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param config - Optional fetch configuration with custom fetch function.
|
|
32
|
-
* @returns An {@link AssetLoader} that loads remote assets via HTTP fetch.
|
|
33
33
|
*/
|
|
34
34
|
export declare function fetchAssetLoader(config?: FetchAssetLoaderConfig): AssetLoader;
|
|
@@ -6,6 +6,9 @@ import { type AssetPathRef, type AssetLoader } from './asset';
|
|
|
6
6
|
* Assets are matched by reference identity — the same {@link AssetPathRef}
|
|
7
7
|
* object used to populate the map must be used to retrieve the data.
|
|
8
8
|
*
|
|
9
|
+
* @param assets - Map of asset refs to their raw byte data.
|
|
10
|
+
* @returns An {@link AssetLoader} backed by the provided in-memory map.
|
|
11
|
+
*
|
|
9
12
|
* @example
|
|
10
13
|
* ```ts
|
|
11
14
|
* const DISTRICTS = localAsset('districts.json');
|
|
@@ -15,8 +18,5 @@ import { type AssetPathRef, type AssetLoader } from './asset';
|
|
|
15
18
|
*
|
|
16
19
|
* loader.get(DISTRICTS).load().subscribe((data) => { ... });
|
|
17
20
|
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param assets - Map of asset refs to their raw byte data.
|
|
20
|
-
* @returns An {@link AssetLoader} backed by the provided in-memory map.
|
|
21
21
|
*/
|
|
22
22
|
export declare function memoryAssetLoader(assets: Map<AssetPathRef, ArrayBuffer>): AssetLoader;
|
|
@@ -31,38 +31,38 @@ export declare class FilterMap<F> implements Destroyable {
|
|
|
31
31
|
*
|
|
32
32
|
* Waits until a filter entry exists for the key, then switches to its filter stream.
|
|
33
33
|
*
|
|
34
|
-
* @param key -
|
|
35
|
-
* @returns
|
|
34
|
+
* @param key - Filter map key to observe.
|
|
35
|
+
* @returns Observable that emits the current filter value for the key.
|
|
36
36
|
*/
|
|
37
37
|
filterForKey(key: FilterMapKey): Observable<F>;
|
|
38
38
|
/**
|
|
39
39
|
* Sets a default filter observable for the given key, used as a fallback when no explicit filter is set.
|
|
40
40
|
*
|
|
41
|
-
* @param key -
|
|
42
|
-
* @param obs -
|
|
41
|
+
* @param key - Filter map key.
|
|
42
|
+
* @param obs - Default filter observable or value.
|
|
43
43
|
*/
|
|
44
44
|
addDefaultFilterObs(key: FilterMapKey, obs: Maybe<ObservableOrValue<F>>): void;
|
|
45
45
|
/**
|
|
46
46
|
* Adds a filter observable for the given key. Multiple observables can be added per key
|
|
47
47
|
* and their emissions are merged together.
|
|
48
48
|
*
|
|
49
|
-
* @param key -
|
|
50
|
-
* @param obs -
|
|
49
|
+
* @param key - Filter map key.
|
|
50
|
+
* @param obs - Filter observable to add.
|
|
51
51
|
*/
|
|
52
52
|
addFilterObs(key: FilterMapKey, obs: Observable<F>): void;
|
|
53
53
|
/**
|
|
54
54
|
* Creates a {@link FilterMapKeyInstance} bound to the given key, providing both
|
|
55
55
|
* {@link FilterSource} and {@link FilterSourceConnector} interfaces for that key.
|
|
56
56
|
*
|
|
57
|
-
* @param key -
|
|
58
|
-
* @returns
|
|
57
|
+
* @param key - Filter map key to bind.
|
|
58
|
+
* @returns Instance for interacting with the filter at the given key.
|
|
59
59
|
*/
|
|
60
60
|
makeInstance(key: FilterMapKey): FilterMapKeyInstance<F>;
|
|
61
61
|
/**
|
|
62
62
|
* Creates an observable that emits a new {@link FilterMapKeyInstance} each time the key changes.
|
|
63
63
|
*
|
|
64
|
-
* @param keyObs -
|
|
65
|
-
* @returns
|
|
64
|
+
* @param keyObs - Observable of filter map keys.
|
|
65
|
+
* @returns Observable that emits instances for the current key.
|
|
66
66
|
*/
|
|
67
67
|
instanceObsForKeyObs(keyObs: Observable<FilterMapKey>): Observable<FilterMapKeyInstance<F>>;
|
|
68
68
|
private _itemForKey;
|
|
@@ -90,13 +90,13 @@ export declare class FilterMapKeyInstance<F> implements FilterSourceConnector<F>
|
|
|
90
90
|
/**
|
|
91
91
|
* Sets the default filter observable for this key.
|
|
92
92
|
*
|
|
93
|
-
* @param filterObs -
|
|
93
|
+
* @param filterObs - The observable to use as the default filter for this key.
|
|
94
94
|
*/
|
|
95
95
|
initWithFilter(filterObs: Observable<F>): void;
|
|
96
96
|
/**
|
|
97
97
|
* Connects a filter source, adding its filter observable to this key's merged filters.
|
|
98
98
|
*
|
|
99
|
-
* @param filterSource -
|
|
99
|
+
* @param filterSource - The filter source whose filter$ will be added to this key's merged stream.
|
|
100
100
|
*/
|
|
101
101
|
connectWithSource(filterSource: FilterSource<F>): void;
|
|
102
102
|
}
|
|
@@ -12,8 +12,8 @@ export type MapFilterWithPresetFn<F extends FilterWithPreset> = (filter: F) => F
|
|
|
12
12
|
* into concrete filter values, then the `preset` field is removed from the result.
|
|
13
13
|
* Filters without a preset are passed through unchanged.
|
|
14
14
|
*
|
|
15
|
-
* @param fn -
|
|
16
|
-
* @returns
|
|
15
|
+
* @param fn - Function that expands a preset into concrete filter values.
|
|
16
|
+
* @returns Mapping function that resolves presets and strips the preset field.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```ts
|
|
@@ -29,13 +29,14 @@ export type MapFilterWithPresetFn<F extends FilterWithPreset> = (filter: F) => F
|
|
|
29
29
|
* const result = resolve({ preset: 'active' });
|
|
30
30
|
* // result === { active: true }
|
|
31
31
|
* ```
|
|
32
|
+
*
|
|
32
33
|
* @__NO_SIDE_EFFECTS__
|
|
33
34
|
*/
|
|
34
35
|
export declare function makeMapFilterWithPresetFn<F extends FilterWithPreset>(fn: MapFilterWithPresetFn<F>): MapFilterWithPresetFn<F>;
|
|
35
36
|
/**
|
|
36
37
|
* RxJS operator that resolves preset references in a filter stream using the provided mapping function.
|
|
37
38
|
*
|
|
38
|
-
* @param fn -
|
|
39
|
-
* @returns
|
|
39
|
+
* @param fn - Function that expands a preset into concrete filter values.
|
|
40
|
+
* @returns Operator that maps filter emissions, resolving any preset references.
|
|
40
41
|
*/
|
|
41
42
|
export declare function mapFilterWithPreset<F extends FilterWithPreset>(fn: MapFilterWithPresetFn<F>): OperatorFunction<F, FilterWithoutPresetString<F>>;
|
|
@@ -68,19 +68,19 @@ export declare class FilterSourceInstance<F> implements FilterSource<F>, Destroy
|
|
|
68
68
|
/**
|
|
69
69
|
* Sets an initial filter observable that takes priority over the default filter.
|
|
70
70
|
*
|
|
71
|
-
* @param filterObs -
|
|
71
|
+
* @param filterObs - Observable providing the initial filter value.
|
|
72
72
|
*/
|
|
73
73
|
initWithFilter(filterObs: Observable<F>): void;
|
|
74
74
|
/**
|
|
75
75
|
* Sets the default filter, used as a fallback when no explicit or initial filter is active.
|
|
76
76
|
*
|
|
77
|
-
* @param filter -
|
|
77
|
+
* @param filter - Default filter value, observable, or undefined to clear.
|
|
78
78
|
*/
|
|
79
79
|
setDefaultFilter(filter: MaybeObservableOrValue<F>): void;
|
|
80
80
|
/**
|
|
81
81
|
* Sets an explicit filter value that takes priority over the initial and default filters.
|
|
82
82
|
*
|
|
83
|
-
* @param filter -
|
|
83
|
+
* @param filter - The filter value to set.
|
|
84
84
|
*/
|
|
85
85
|
setFilter(filter: F): void;
|
|
86
86
|
/**
|
|
@@ -93,7 +93,7 @@ export declare class FilterSourceInstance<F> implements FilterSource<F>, Destroy
|
|
|
93
93
|
* When enabled, any new emission from the initial filter observable clears the explicit
|
|
94
94
|
* filter, causing `filter$` to fall back to the initial filter value.
|
|
95
95
|
*
|
|
96
|
-
* @param initialFilterTakesPriority -
|
|
96
|
+
* @param initialFilterTakesPriority - Whether initial filter changes should reset the explicit filter.
|
|
97
97
|
*/
|
|
98
98
|
setInitialFilterTakesPriority(initialFilterTakesPriority: boolean): void;
|
|
99
99
|
protected initFilterTakesPriority(): void;
|
|
@@ -124,9 +124,8 @@ export interface ItemAccumulatorNextPageUntilResultsCountResult extends Page {
|
|
|
124
124
|
* Automatically pages through an accumulator's iteration until the desired number of results
|
|
125
125
|
* is reached or no more pages are available.
|
|
126
126
|
*
|
|
127
|
-
* @param config -
|
|
128
|
-
* @returns
|
|
129
|
-
*
|
|
130
|
-
* @throws Rejects if the iteration encounters an error during loading
|
|
127
|
+
* @param config - Configuration specifying the accumulator, result limit, and counting function.
|
|
128
|
+
* @returns Promise resolving to the final page number and total results count.
|
|
129
|
+
* @throws {Error} Rejects if the iteration encounters a loading error.
|
|
131
130
|
*/
|
|
132
131
|
export declare function itemAccumulatorNextPageUntilResultsCount<O>(config: ItemAccumulatorNextPageUntilResultsCountConfig<O>): Promise<ItemAccumulatorNextPageUntilResultsCountResult>;
|
|
@@ -7,8 +7,8 @@ import { type ItemAccumulator, type PageItemAccumulator } from './iteration.accu
|
|
|
7
7
|
* Designed for accumulators where each page returns an array of items. Concatenates all
|
|
8
8
|
* page results into one flat array that grows as new pages are loaded.
|
|
9
9
|
*
|
|
10
|
-
* @param accumulator -
|
|
11
|
-
* @returns
|
|
10
|
+
* @param accumulator - Accumulator whose page results are arrays to flatten.
|
|
11
|
+
* @returns Observable emitting the flattened array of all accumulated items.
|
|
12
12
|
*/
|
|
13
13
|
export declare function flattenAccumulatorResultItemArray<T, I = unknown>(accumulator: ItemAccumulator<T[], I>): Observable<T[]>;
|
|
14
14
|
/**
|
|
@@ -18,8 +18,8 @@ export declare function flattenAccumulatorResultItemArray<T, I = unknown>(accumu
|
|
|
18
18
|
* The loading state reflects whether a page is currently being fetched, while the value
|
|
19
19
|
* always contains the full flattened array of all items loaded so far.
|
|
20
20
|
*
|
|
21
|
-
* @param accumulator -
|
|
22
|
-
* @returns
|
|
21
|
+
* @param accumulator - Page accumulator whose results are arrays to flatten.
|
|
22
|
+
* @returns Observable of the combined loading state with all accumulated items.
|
|
23
23
|
*/
|
|
24
24
|
export declare function accumulatorFlattenPageListLoadingState<T, I = unknown>(accumulator: PageItemAccumulator<T[], I>): Observable<PageListLoadingState<T>>;
|
|
25
25
|
/**
|
|
@@ -29,14 +29,14 @@ export declare function accumulatorFlattenPageListLoadingState<T, I = unknown>(a
|
|
|
29
29
|
* Unlike {@link accumulatorFlattenPageListLoadingState}, this does not flatten arrays —
|
|
30
30
|
* each accumulated value is included as-is.
|
|
31
31
|
*
|
|
32
|
-
* @param accumulator -
|
|
33
|
-
* @returns
|
|
32
|
+
* @param accumulator - Page accumulator to observe.
|
|
33
|
+
* @returns Observable of the combined loading state with all accumulated items.
|
|
34
34
|
*/
|
|
35
35
|
export declare function accumulatorCurrentPageListLoadingState<V, I = unknown>(accumulator: PageItemAccumulator<V, I>): Observable<PageListLoadingState<V>>;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the latest loaded page number from the input accumulator's underlying iteration.
|
|
38
38
|
*
|
|
39
|
-
* @param pageItemAccumulator -
|
|
40
|
-
* @returns
|
|
39
|
+
* @param pageItemAccumulator - Accumulator to observe the current page from.
|
|
40
|
+
* @returns Observable emitting the most recently loaded page number.
|
|
41
41
|
*/
|
|
42
42
|
export declare function pageItemAccumulatorCurrentPage(pageItemAccumulator: PageItemAccumulator<any, any>): Observable<number>;
|
|
@@ -21,7 +21,7 @@ export interface MappedItemIterationInstanceMapConfig<O, I, M extends LoadingSta
|
|
|
21
21
|
* Whether destroying the mapped instance also destroys the underlying iteration.
|
|
22
22
|
* Defaults to `true`.
|
|
23
23
|
*/
|
|
24
|
-
forwardDestroy?: boolean;
|
|
24
|
+
readonly forwardDestroy?: boolean;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Concrete instance of a mapped item iteration, exposing the transformed state observables
|
|
@@ -43,8 +43,8 @@ export interface MappedItemIterationInstance<O, I = unknown, M extends LoadingSt
|
|
|
43
43
|
*
|
|
44
44
|
* Control flow (next, hasNext, canLoadMore) is delegated directly to the underlying iteration.
|
|
45
45
|
*
|
|
46
|
-
* @param itemIterator -
|
|
47
|
-
* @param config -
|
|
48
|
-
* @returns
|
|
46
|
+
* @param itemIterator - The source iteration to wrap.
|
|
47
|
+
* @param config - Mapping configuration for transforming loading state values.
|
|
48
|
+
* @returns Mapped iteration instance with transformed state observables.
|
|
49
49
|
*/
|
|
50
50
|
export declare function mapItemIteration<O, I = unknown, M extends LoadingState<O> = LoadingState<O>, L extends LoadingState<I> = LoadingState<I>, N extends ItemIteration<I, L> = ItemIteration<I, L>>(itemIterator: N, config: MappedItemIterationInstanceMapConfig<O, I, M, L>): MappedItemIterationInstance<O, I, M, L, N>;
|
|
@@ -16,8 +16,8 @@ export interface MappedPageItemIterationInstance<O, I = unknown, M extends PageL
|
|
|
16
16
|
* and transforms its loading state values while preserving page-level operations
|
|
17
17
|
* (nextPage, page load limits, latestLoadedPage).
|
|
18
18
|
*
|
|
19
|
-
* @param itemIteration -
|
|
20
|
-
* @param config -
|
|
21
|
-
* @returns
|
|
19
|
+
* @param itemIteration - The source page iteration to wrap.
|
|
20
|
+
* @param config - Mapping configuration for transforming loading state values.
|
|
21
|
+
* @returns Mapped page iteration instance.
|
|
22
22
|
*/
|
|
23
23
|
export declare function mappedPageItemIteration<O, I = unknown, M extends PageLoadingState<O> = PageLoadingState<O>, L extends PageLoadingState<I> = PageLoadingState<I>, N extends PageItemIteration<I, L> = PageItemIteration<I, L>>(itemIteration: N, config: MappedItemIterationInstanceMapConfig<O, I, M, L>): MappedPageItemIterationInstance<O, I, M, L, N>;
|
|
@@ -5,8 +5,8 @@ import { type Maybe, type GetterOrValue, type PageNumber } from '@dereekb/util';
|
|
|
5
5
|
* Combines an iteration's `hasNext$` and `canLoadMore$` into a single observable that emits
|
|
6
6
|
* `true` only when both conditions are met (more items exist and the page limit hasn't been reached).
|
|
7
7
|
*
|
|
8
|
-
* @param iteration -
|
|
9
|
-
* @returns
|
|
8
|
+
* @param iteration - The iteration to check.
|
|
9
|
+
* @returns Observable that emits `true` when more items can be loaded.
|
|
10
10
|
*/
|
|
11
11
|
export declare function iterationHasNextAndCanLoadMore<V>(iteration: ItemIteration<V>): Observable<boolean>;
|
|
12
12
|
/**
|
|
@@ -14,22 +14,20 @@ export declare function iterationHasNextAndCanLoadMore<V>(iteration: ItemIterati
|
|
|
14
14
|
*
|
|
15
15
|
* Falls back to the provided default limit if no max is configured on the iterator.
|
|
16
16
|
*
|
|
17
|
-
* @param iterator -
|
|
18
|
-
* @param defaultLimit -
|
|
19
|
-
* @returns
|
|
20
|
-
*
|
|
21
|
-
* @throws {Error}
|
|
22
|
-
* @throws Rejects if the iteration encounters a loading error
|
|
17
|
+
* @param iterator - The page iteration to advance.
|
|
18
|
+
* @param defaultLimit - Fallback page limit if none is configured (defaults to 100)
|
|
19
|
+
* @returns Promise resolving to the last loaded page number.
|
|
20
|
+
* @throws {Error} If neither a max page load limit nor a default limit is defined.
|
|
21
|
+
* @throws {Error} Rejects if the iteration encounters a loading error.
|
|
23
22
|
*/
|
|
24
23
|
export declare function iteratorNextPageUntilMaxPageLoadLimit(iterator: PageItemIteration, defaultLimit?: Maybe<number>): Promise<number>;
|
|
25
24
|
/**
|
|
26
25
|
* Automatically pages through a {@link PageItemIteration} until the specified page number is reached,
|
|
27
26
|
* respecting the iteration's max page load limit.
|
|
28
27
|
*
|
|
29
|
-
* @param iteration -
|
|
30
|
-
* @param page -
|
|
31
|
-
* @returns
|
|
32
|
-
*
|
|
33
|
-
* @throws Rejects if the iteration encounters a loading error
|
|
28
|
+
* @param iteration - The page iteration to advance.
|
|
29
|
+
* @param page - Target page number (or getter returning one) representing total pages to load.
|
|
30
|
+
* @returns Promise resolving to the last loaded page number.
|
|
31
|
+
* @throws {Error} Rejects if the iteration encounters a loading error.
|
|
34
32
|
*/
|
|
35
33
|
export declare function iteratorNextPageUntilPage(iteration: PageItemIteration, page: GetterOrValue<number>): Promise<PageNumber>;
|
|
@@ -113,8 +113,8 @@ export declare class ItemPageIterator<V, F, C extends ItemPageIterationConfig<F>
|
|
|
113
113
|
/**
|
|
114
114
|
* Creates a new iteration instance with the given configuration.
|
|
115
115
|
*
|
|
116
|
-
* @param config -
|
|
117
|
-
* @returns
|
|
116
|
+
* @param config - Filter and page limit configuration for this iteration session.
|
|
117
|
+
* @returns New iteration instance ready to begin loading pages.
|
|
118
118
|
*/
|
|
119
119
|
instance(config: C): ItemPageIterationInstance<V, F, C>;
|
|
120
120
|
}
|
|
@@ -234,7 +234,7 @@ export declare class ItemPageIterationInstance<V, F, C extends ItemPageIteration
|
|
|
234
234
|
* - `end` is not explicitly `false` and the result value is empty/null (via `hasValueOrNotEmpty`)
|
|
235
235
|
* - Error results are never considered the end
|
|
236
236
|
*
|
|
237
|
-
* @param result -
|
|
238
|
-
* @returns `true` if this result indicates no more pages are available
|
|
237
|
+
* @param result - The page result to check.
|
|
238
|
+
* @returns `true` if this result indicates no more pages are available.
|
|
239
239
|
*/
|
|
240
240
|
export declare function isItemPageIteratorResultEndResult<V>(result: ItemPageIteratorResult<V>): boolean;
|
|
@@ -7,6 +7,8 @@ import { type Maybe } from '@dereekb/util';
|
|
|
7
7
|
*
|
|
8
8
|
* Useful for flattening an observable of optional loading contexts into a single stream of loading events.
|
|
9
9
|
*
|
|
10
|
+
* @returns An RxJS operator that switches to the stream$ of each non-null LoadingContext.
|
|
11
|
+
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```ts
|
|
12
14
|
* const context$ = new BehaviorSubject<Maybe<LoadingContext>>(myLoadingContext);
|
|
@@ -17,7 +19,5 @@ import { type Maybe } from '@dereekb/util';
|
|
|
17
19
|
* // emits LoadingContextEvent values from myLoadingContext.stream$
|
|
18
20
|
* // emits undefined when context$ emits null/undefined
|
|
19
21
|
* ```
|
|
20
|
-
*
|
|
21
|
-
* @returns an RxJS operator that switches to the stream$ of each non-null LoadingContext
|
|
22
22
|
*/
|
|
23
23
|
export declare function switchMapMaybeLoadingContextStream(): OperatorFunction<Maybe<LoadingContext>, Maybe<LoadingContextEvent>>;
|
|
@@ -29,7 +29,7 @@ export declare class SimpleLoadingContext implements LoadingContext, Destroyable
|
|
|
29
29
|
/**
|
|
30
30
|
* Whether the current state has a non-null error.
|
|
31
31
|
*
|
|
32
|
-
* @returns
|
|
32
|
+
* @returns True if the current state contains an error.
|
|
33
33
|
*/
|
|
34
34
|
hasError(): boolean;
|
|
35
35
|
/**
|
|
@@ -43,14 +43,14 @@ export declare class SimpleLoadingContext implements LoadingContext, Destroyable
|
|
|
43
43
|
/**
|
|
44
44
|
* Sets the loading flag and clears any existing error.
|
|
45
45
|
*
|
|
46
|
-
* @param loading -
|
|
46
|
+
* @param loading - Whether loading is in progress (defaults to true)
|
|
47
47
|
*/
|
|
48
48
|
setLoading(loading?: boolean): void;
|
|
49
49
|
/**
|
|
50
50
|
* Sets an error state with an optional loading flag.
|
|
51
51
|
*
|
|
52
|
-
* @param error -
|
|
53
|
-
* @param loading -
|
|
52
|
+
* @param error - The error to set.
|
|
53
|
+
* @param loading - Whether loading is still in progress (defaults to false)
|
|
54
54
|
*/
|
|
55
55
|
setError(error: ReadableError, loading?: boolean): void;
|
|
56
56
|
}
|
|
@@ -80,9 +80,9 @@ export type LoadingEventForLoadingPairConfigInput = Pick<LoadingStateContextConf
|
|
|
80
80
|
* Determines the `loading` flag based on whether an error is present, whether the value is defined,
|
|
81
81
|
* and the `showLoadingOnUndefinedValue` setting. Loading progress is only included while loading.
|
|
82
82
|
*
|
|
83
|
-
* @param state -
|
|
84
|
-
* @param input -
|
|
85
|
-
* @returns
|
|
83
|
+
* @param state - The current loading state to convert into a context event.
|
|
84
|
+
* @param input - Configuration input controlling how the loading flag is derived.
|
|
85
|
+
* @returns A loading state context event derived from the given state.
|
|
86
86
|
*/
|
|
87
87
|
export declare const DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION: <T = unknown, S extends LoadingState<T> = LoadingState<T>, E extends LoadingStateContextEvent = LoadingContextEvent & S>(state: S, input: LoadingEventForLoadingPairConfigInput) => LoadingStateContextEvent<T>;
|
|
88
88
|
/**
|
|
@@ -96,6 +96,9 @@ export type LoadingStateContextInput<T = unknown, S extends LoadingState<T> = Lo
|
|
|
96
96
|
* Accepts either a raw observable or a {@link LoadingStateContextConfig} for fine-grained control
|
|
97
97
|
* over how loading events are derived from the state.
|
|
98
98
|
*
|
|
99
|
+
* @param input - Optional observable or config to initialize the context.
|
|
100
|
+
* @returns A mutable loading state context with reactive accessors.
|
|
101
|
+
*
|
|
99
102
|
* @example
|
|
100
103
|
* ```ts
|
|
101
104
|
* // Create a context from a state observable
|
|
@@ -113,8 +116,5 @@ export type LoadingStateContextInput<T = unknown, S extends LoadingState<T> = Lo
|
|
|
113
116
|
* // Clean up
|
|
114
117
|
* context.destroy();
|
|
115
118
|
* ```
|
|
116
|
-
*
|
|
117
|
-
* @param input - optional observable or config to initialize the context
|
|
118
|
-
* @returns a mutable loading state context with reactive accessors
|
|
119
119
|
*/
|
|
120
120
|
export declare function loadingStateContext<T = unknown, S extends LoadingState<T> = LoadingState<T>, E extends LoadingStateContextEvent = LoadingContextEvent & S>(input?: LoadingStateContextInput<T, S, E>): MutableLoadingStateContext<T, S, E>;
|
|
@@ -55,6 +55,9 @@ export type ListLoadingStateContextInput<L, S extends ListLoadingState<L> = List
|
|
|
55
55
|
* Extends {@link loadingStateContext} with list-aware behavior, including optional array length limiting
|
|
56
56
|
* via {@link LimitArrayConfig} and empty-state detection streams.
|
|
57
57
|
*
|
|
58
|
+
* @param input - Optional observable or config to initialize the context.
|
|
59
|
+
* @returns A mutable list loading state context.
|
|
60
|
+
*
|
|
58
61
|
* @example
|
|
59
62
|
* ```ts
|
|
60
63
|
* const context = listLoadingStateContext<string>();
|
|
@@ -72,8 +75,5 @@ export type ListLoadingStateContextInput<L, S extends ListLoadingState<L> = List
|
|
|
72
75
|
*
|
|
73
76
|
* context.destroy();
|
|
74
77
|
* ```
|
|
75
|
-
*
|
|
76
|
-
* @param input - optional observable or config to initialize the context
|
|
77
|
-
* @returns a mutable list loading state context
|
|
78
78
|
*/
|
|
79
79
|
export declare function listLoadingStateContext<L, S extends ListLoadingState<L> = ListLoadingState<L>>(input?: ListLoadingStateContextInput<L, S>): MutableListLoadingStateContext<L, S>;
|