@dereekb/rxjs 9.15.7 → 9.15.8
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/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/lib/loading/loading.state.d.ts +1 -1
- package/src/lib/loading/loading.state.js +1 -1
- package/src/lib/loading/loading.state.rxjs.d.ts +20 -4
- package/src/lib/loading/loading.state.rxjs.js +34 -5
- package/src/lib/loading/loading.state.rxjs.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.15.8](https://github.com/dereekb/dbx-components/compare/v9.15.7-dev...v9.15.8) (2022-11-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [9.15.7](https://github.com/dereekb/dbx-components/compare/v9.15.6-dev...v9.15.7) (2022-11-17)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/rxjs",
|
|
3
|
-
"version": "9.15.
|
|
3
|
+
"version": "9.15.8",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"rxjs": "^7.5.0",
|
|
10
|
-
"@dereekb/util": "9.15.
|
|
10
|
+
"@dereekb/util": "9.15.8",
|
|
11
11
|
"lodash.isequal": "^4.5.0",
|
|
12
12
|
"make-error": "^1.3.0",
|
|
13
13
|
"class-validator": "^0.13.2",
|
|
@@ -104,7 +104,7 @@ export declare function isSuccessLoadingState<L extends LoadingState>(state: May
|
|
|
104
104
|
export declare function isErrorLoadingState<L extends LoadingState>(state: Maybe<L>): boolean;
|
|
105
105
|
export declare function loadingStateHasFinishedLoading<L extends LoadingState>(state: Maybe<L>): boolean;
|
|
106
106
|
/**
|
|
107
|
-
* Whether or not the input loading state has a non-null value.
|
|
107
|
+
* Whether or not the input loading state has finished loading and has a non-null value.
|
|
108
108
|
*
|
|
109
109
|
* @param state
|
|
110
110
|
* @returns
|
|
@@ -139,7 +139,7 @@ function loadingStateHasFinishedLoading(state) {
|
|
|
139
139
|
}
|
|
140
140
|
exports.loadingStateHasFinishedLoading = loadingStateHasFinishedLoading;
|
|
141
141
|
/**
|
|
142
|
-
* Whether or not the input loading state has a non-null value.
|
|
142
|
+
* Whether or not the input loading state has finished loading and has a non-null value.
|
|
143
143
|
*
|
|
144
144
|
* @param state
|
|
145
145
|
* @returns
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Maybe } from '@dereekb/util';
|
|
1
|
+
import { Maybe, ReadableError } from '@dereekb/util';
|
|
2
2
|
import { MonoTypeOperatorFunction, OperatorFunction, Observable } from 'rxjs';
|
|
3
|
-
import { LoadingState, PageLoadingState, MapLoadingStateResultsConfiguration, LoadingStateValue } from './loading.state';
|
|
3
|
+
import { LoadingState, PageLoadingState, MapLoadingStateResultsConfiguration, LoadingStateValue, LoadingStateType } from './loading.state';
|
|
4
4
|
/**
|
|
5
5
|
* Wraps an observable output and maps the value to a LoadingState.
|
|
6
6
|
*
|
|
@@ -23,9 +23,25 @@ export declare function startWithBeginLoading<L extends LoadingState>(): MonoTyp
|
|
|
23
23
|
export declare function startWithBeginLoading<L extends LoadingState>(state?: Partial<LoadingState>): MonoTypeOperatorFunction<L>;
|
|
24
24
|
export declare function startWithBeginLoading<L extends PageLoadingState>(state?: Partial<PageLoadingState>): MonoTypeOperatorFunction<L>;
|
|
25
25
|
/**
|
|
26
|
-
* Returns the value once the LoadingState has finished loading.
|
|
26
|
+
* Returns the value once the LoadingState has finished loading with success.
|
|
27
27
|
*/
|
|
28
|
-
export declare function valueFromLoadingState<L extends LoadingState>(): OperatorFunction<L,
|
|
28
|
+
export declare function valueFromLoadingState<L extends LoadingState>(): OperatorFunction<L, LoadingStateValue<L>>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the error once the LoadingState has finished loading with an error.
|
|
31
|
+
*/
|
|
32
|
+
export declare function errorFromLoadingState<L extends LoadingState>(): OperatorFunction<L, ReadableError>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the value once the LoadingState has finished loading, even if an error occured or there is no value.
|
|
35
|
+
*/
|
|
36
|
+
export declare function valueFromFinishedLoadingState<L extends LoadingState>(): OperatorFunction<L, Maybe<LoadingStateValue<L>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Executes a function when the piped LoadingState has the configured state.
|
|
39
|
+
*
|
|
40
|
+
* @param fn
|
|
41
|
+
*/
|
|
42
|
+
export declare function tapOnLoadingStateType<L extends LoadingState>(fn: (state: L) => void, type: LoadingStateType): MonoTypeOperatorFunction<L>;
|
|
43
|
+
export declare function tapOnLoadingStateType<L extends LoadingState>(fn: (state: L) => void, type: LoadingStateType): MonoTypeOperatorFunction<L>;
|
|
44
|
+
export declare function tapOnLoadingStateType<L extends PageLoadingState>(fn: (state: L) => void, type: LoadingStateType): MonoTypeOperatorFunction<L>;
|
|
29
45
|
/**
|
|
30
46
|
* Executes a function when the input state has a successful value.
|
|
31
47
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapLoadingState = exports.tapOnLoadingStateSuccess = exports.valueFromLoadingState = exports.startWithBeginLoading = exports.combineLoadingStates = exports.loadingStateFromObs = void 0;
|
|
3
|
+
exports.mapLoadingState = exports.tapOnLoadingStateSuccess = exports.tapOnLoadingStateType = exports.valueFromFinishedLoadingState = exports.errorFromLoadingState = exports.valueFromLoadingState = exports.startWithBeginLoading = exports.combineLoadingStates = exports.loadingStateFromObs = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const rxjs_2 = require("../rxjs");
|
|
6
6
|
const loading_state_1 = require("./loading.state");
|
|
@@ -27,21 +27,50 @@ function startWithBeginLoading(state) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.startWithBeginLoading = startWithBeginLoading;
|
|
29
29
|
/**
|
|
30
|
-
* Returns the value once the LoadingState has finished loading.
|
|
30
|
+
* Returns the value once the LoadingState has finished loading with success.
|
|
31
31
|
*/
|
|
32
32
|
function valueFromLoadingState() {
|
|
33
33
|
return (obs) => {
|
|
34
|
-
return obs.pipe((0, rxjs_1.filter)(loading_state_1.
|
|
34
|
+
return obs.pipe((0, rxjs_1.filter)(loading_state_1.loadingStateHasValue), (0, rxjs_1.map)((x) => x.value));
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
exports.valueFromLoadingState = valueFromLoadingState;
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Returns the error once the LoadingState has finished loading with an error.
|
|
40
|
+
*/
|
|
41
|
+
function errorFromLoadingState() {
|
|
42
|
+
return (obs) => {
|
|
43
|
+
return obs.pipe((0, rxjs_1.filter)(loading_state_1.loadingStateHasError), (0, rxjs_1.map)((x) => x.error));
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.errorFromLoadingState = errorFromLoadingState;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the value once the LoadingState has finished loading, even if an error occured or there is no value.
|
|
49
|
+
*/
|
|
50
|
+
function valueFromFinishedLoadingState() {
|
|
51
|
+
return (obs) => {
|
|
52
|
+
return obs.pipe((0, rxjs_1.filter)(loading_state_1.loadingStateHasFinishedLoading), (0, rxjs_1.map)((x) => x.value));
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.valueFromFinishedLoadingState = valueFromFinishedLoadingState;
|
|
56
|
+
function tapOnLoadingStateType(fn, type) {
|
|
57
|
+
let decisionFunction;
|
|
58
|
+
if (type === loading_state_1.LoadingStateType.LOADING) {
|
|
59
|
+
decisionFunction = loading_state_1.loadingStateIsLoading;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
decisionFunction = (state) => (0, loading_state_1.loadingStateType)(state) === type;
|
|
63
|
+
}
|
|
39
64
|
return (0, rxjs_1.tap)((state) => {
|
|
40
|
-
if (
|
|
65
|
+
if (state != null && decisionFunction(state)) {
|
|
41
66
|
fn(state);
|
|
42
67
|
}
|
|
43
68
|
});
|
|
44
69
|
}
|
|
70
|
+
exports.tapOnLoadingStateType = tapOnLoadingStateType;
|
|
71
|
+
function tapOnLoadingStateSuccess(fn) {
|
|
72
|
+
return tapOnLoadingStateType(fn, loading_state_1.LoadingStateType.SUCCESS);
|
|
73
|
+
}
|
|
45
74
|
exports.tapOnLoadingStateSuccess = tapOnLoadingStateSuccess;
|
|
46
75
|
function mapLoadingState(config) {
|
|
47
76
|
return (0, rxjs_1.map)((state) => (0, loading_state_1.mapLoadingStateResults)(state, config));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.state.rxjs.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/loading/loading.state.rxjs.ts"],"names":[],"mappings":";;;AACA,+BAAoL;AACpL,kCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"loading.state.rxjs.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/loading/loading.state.rxjs.ts"],"names":[],"mappings":";;;AACA,+BAAoL;AACpL,kCAA2C;AAC3C,mDAAiV;AAEjV;;;;GAIG;AACH,SAAgB,mBAAmB,CAAI,GAAkB,EAAE,SAAmB;IAC5E,IAAI,SAAS,EAAE;QACb,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,IAAA,YAAK,GAAE,CAAC,CAAC;KACzB;IAED,OAAO,GAAG,CAAC,IAAI,CACb,IAAA,UAAG,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,EAC7D,IAAA,iBAAU,EAA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