@dereekb/dbx-core 11.0.20 → 11.0.21
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/esm2022/lib/action/action.mjs +1 -1
- package/esm2022/lib/action/action.store.mjs +13 -1
- package/esm2022/lib/action/action.store.source.mjs +7 -1
- package/fesm2022/dereekb-dbx-core.mjs +18 -0
- package/fesm2022/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/action.d.ts +15 -0
- package/lib/action/action.store.d.ts +13 -1
- package/lib/action/action.store.source.d.ts +3 -1
- package/package.json +1 -1
package/lib/action/action.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LoadingStateType } from '@dereekb/rxjs';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
2
3
|
/**
|
|
3
4
|
* Used by ActionContextState to denote what state the action is in.
|
|
4
5
|
*/
|
|
@@ -36,6 +37,20 @@ export declare enum DbxActionState {
|
|
|
36
37
|
*/
|
|
37
38
|
RESOLVED = "resolved"
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Contains the input value and the output result from a DbxAction.
|
|
42
|
+
*/
|
|
43
|
+
export interface DbxActionSuccessPair<T, O> {
|
|
44
|
+
readonly value: T;
|
|
45
|
+
readonly result: Maybe<O>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Contains the input value and the output error from a DbxAction.
|
|
49
|
+
*/
|
|
50
|
+
export interface DbxActionRejectedPair<T> {
|
|
51
|
+
readonly value: T;
|
|
52
|
+
readonly error: unknown;
|
|
53
|
+
}
|
|
39
54
|
/**
|
|
40
55
|
* Unique key for disabling/enabling.
|
|
41
56
|
*/
|
|
@@ -3,7 +3,7 @@ import { ComponentStore } from '@ngrx/component-store';
|
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { BooleanStringKeyArray, Maybe, ReadableError } from '@dereekb/util';
|
|
5
5
|
import { LoadingStateType, LoadingState, LockSet } from '@dereekb/rxjs';
|
|
6
|
-
import { DbxActionState } from './action';
|
|
6
|
+
import { DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair } from './action';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
export declare function isActionContextEnabled(state: ActionContextState): boolean;
|
|
9
9
|
export declare function isActionContextDisabled(state: ActionContextState): boolean;
|
|
@@ -48,6 +48,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
48
48
|
* Returns the current disabled reasons/keys.
|
|
49
49
|
*/
|
|
50
50
|
readonly disabledKeys$: Observable<string[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Current value of the state.
|
|
53
|
+
*/
|
|
54
|
+
readonly currentValue$: Observable<Maybe<T>>;
|
|
51
55
|
/**
|
|
52
56
|
* Maps the current state to true or not when the action state changes to/from disabled.
|
|
53
57
|
*/
|
|
@@ -68,6 +72,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
68
72
|
* Pipes the error on the rejection state.
|
|
69
73
|
*/
|
|
70
74
|
readonly rejected$: Observable<Maybe<ReadableError>>;
|
|
75
|
+
/**
|
|
76
|
+
* Pipes the result when the ActionState becomes rejected.
|
|
77
|
+
*/
|
|
78
|
+
readonly rejectedPair$: Observable<DbxActionRejectedPair<T>>;
|
|
71
79
|
/**
|
|
72
80
|
* Pipes the result when the ActionState becomes working.
|
|
73
81
|
*/
|
|
@@ -84,6 +92,10 @@ export declare class ActionContextStore<T = unknown, O = unknown> extends Compon
|
|
|
84
92
|
* Pipes the result when the ActionState becomes success.
|
|
85
93
|
*/
|
|
86
94
|
readonly success$: Observable<Maybe<O>>;
|
|
95
|
+
/**
|
|
96
|
+
* Pipes the result when the ActionState becomes success.
|
|
97
|
+
*/
|
|
98
|
+
readonly successPair$: Observable<DbxActionSuccessPair<T, O>>;
|
|
87
99
|
/**
|
|
88
100
|
* Whether or not it is currently in a success state.
|
|
89
101
|
*/
|
|
@@ -2,7 +2,7 @@ import { Observable, Subscription } from 'rxjs';
|
|
|
2
2
|
import { LockSet, LoadingState, LoadingStateType } from '@dereekb/rxjs';
|
|
3
3
|
import { Destroyable, Maybe, ReadableError } from '@dereekb/util';
|
|
4
4
|
import { ActionContextState, ActionContextStore } from './action.store';
|
|
5
|
-
import { DbxActionDisabledKey, DbxActionState } from './action';
|
|
5
|
+
import { DbxActionDisabledKey, DbxActionRejectedPair, DbxActionState, DbxActionSuccessPair } from './action';
|
|
6
6
|
/**
|
|
7
7
|
* Source that provides a ActionContextStore observable.
|
|
8
8
|
*/
|
|
@@ -43,8 +43,10 @@ export declare class DbxActionContextStoreSourceInstance<T = unknown, O = unknow
|
|
|
43
43
|
get triggered$(): Observable<boolean>;
|
|
44
44
|
get valueReady$(): Observable<T>;
|
|
45
45
|
get success$(): Observable<Maybe<O>>;
|
|
46
|
+
get successPair$(): Observable<DbxActionSuccessPair<T, O>>;
|
|
46
47
|
get error$(): Observable<Maybe<ReadableError>>;
|
|
47
48
|
get rejected$(): Observable<Maybe<ReadableError>>;
|
|
49
|
+
get rejectedPair$(): Observable<DbxActionRejectedPair<T>>;
|
|
48
50
|
get isModified$(): Observable<boolean>;
|
|
49
51
|
get canTrigger$(): Observable<boolean>;
|
|
50
52
|
get isModifiedAndCanTriggerUpdates$(): Observable<boolean>;
|