state-decorator 7.2.0 → 7.3.0-optim.1

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 (63) hide show
  1. package/development.d.ts +10 -10
  2. package/development.js +1 -1
  3. package/development.js.map +1 -1
  4. package/es/development.d.ts +10 -10
  5. package/es/development.js +1 -1
  6. package/es/development.js.map +1 -1
  7. package/es/graph.d.ts +8 -8
  8. package/es/helpers.d.ts +67 -67
  9. package/es/helpers.js +1 -1
  10. package/es/helpers.js.map +1 -1
  11. package/es/impl.d.ts +209 -199
  12. package/es/impl.js +1 -1
  13. package/es/impl.js.map +1 -1
  14. package/es/index.d.ts +169 -169
  15. package/es/index.js +1 -1
  16. package/es/index.js.map +1 -1
  17. package/es/middlewares.d.ts +3 -3
  18. package/es/middlewares.js +1 -1
  19. package/es/middlewares.js.map +1 -1
  20. package/es/shallow.d.ts +1 -1
  21. package/es/test.d.ts +122 -122
  22. package/es/test.js +1 -1
  23. package/es/test.js.map +1 -1
  24. package/es/types.d.ts +386 -386
  25. package/es/v5.d.ts +45 -45
  26. package/es/v5.js +1 -1
  27. package/es/v5.js.map +1 -1
  28. package/es/v5_test.d.ts +57 -57
  29. package/es/v5_test.js +1 -1
  30. package/es/v5_test.js.map +1 -1
  31. package/es/v5_types.d.ts +213 -213
  32. package/es/v6.d.ts +21 -21
  33. package/es/v6.js +1 -1
  34. package/es/v6.js.map +1 -1
  35. package/graph.d.ts +8 -8
  36. package/helpers.d.ts +67 -67
  37. package/helpers.js +1 -1
  38. package/helpers.js.map +1 -1
  39. package/impl.d.ts +209 -199
  40. package/impl.js +1 -1
  41. package/impl.js.map +1 -1
  42. package/index.d.ts +169 -169
  43. package/index.js +1 -1
  44. package/index.js.map +1 -1
  45. package/middlewares.d.ts +3 -3
  46. package/middlewares.js +1 -1
  47. package/middlewares.js.map +1 -1
  48. package/package.json +1 -1
  49. package/shallow.d.ts +1 -1
  50. package/test.d.ts +122 -122
  51. package/test.js +1 -1
  52. package/test.js.map +1 -1
  53. package/types.d.ts +386 -386
  54. package/v5.d.ts +45 -45
  55. package/v5.js +1 -1
  56. package/v5.js.map +1 -1
  57. package/v5_test.d.ts +57 -57
  58. package/v5_test.js +1 -1
  59. package/v5_test.js.map +1 -1
  60. package/v5_types.d.ts +213 -213
  61. package/v6.d.ts +21 -21
  62. package/v6.js +1 -1
  63. package/v6.js.map +1 -1
package/impl.d.ts CHANGED
@@ -1,199 +1,209 @@
1
- import { AsyncAction, SimpleSyncAction, SyncAction, StoreAction, AsyncActionPromise, AsyncActionPromiseGet, PromiseProvider, DecoratedActions, InternalLoadingMap, StoreOptions, InvocationContextActions, OnMountInvocationContext, OnPropsChangeEffectsContext, ContextState, Middleware, MiddlewareFactory, ContextWithDerived, PromiseIdErrorMap, ErrorMap, ErrorParallelMap, OnUnMountInvocationContext, AbortedActions, ClearErrorFunc, StoreConfig, StoreConfigFunc } from './types';
2
- export type SetStateFunc<S, A> = (newState: S, newLoadingMap: InternalLoadingMap<A>, actionName: keyof A | 'onPropsChange', actionType: 'preEffects' | 'effects' | 'errorEffects' | null, // FIXME
3
- isAsync: boolean, actionCtx: any, propsChanged: boolean, isInit?: boolean) => void;
4
- /** @internal */
5
- export type PromiseMap<A> = {
6
- [name in keyof A]?: {
7
- [promiseId: string]: {
8
- promise: Promise<any>;
9
- refArgs: any[];
10
- abortController: AbortController;
11
- };
12
- };
13
- };
14
- /** @internal */
15
- export type FutureActions = {
16
- args: any[];
17
- resolve: (...args: any[]) => void;
18
- reject: (...args: any[]) => void;
19
- timestamp?: number;
20
- };
21
- /** @internal */
22
- export type ConflictActionsMap<A> = {
23
- [name in keyof A]?: FutureActions[];
24
- };
25
- /** @internal */
26
- export type AsyncActionExecContext<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P> = {
27
- actionName: keyof A;
28
- action: AsyncActionPromise<S, F, A, P, DS>;
29
- stateRef: Ref<S>;
30
- derivedStateRef: Ref<DerivedState<DS>>;
31
- propsRef: Ref<P>;
32
- loadingParallelMapRef: Ref<InternalLoadingMap<A>>;
33
- errorMapRef: Ref<ErrorParallelMap<A>>;
34
- promisesRef: Ref<PromiseMap<A>>;
35
- conflictActionsRef: Ref<ConflictActionsMap<A>>;
36
- actionsRef: Ref<A>;
37
- initializedRef: Ref<boolean>;
38
- options: StoreOptions<S, A, P, any>;
39
- setState: SetStateFunc<S, A>;
40
- clearError: ClearErrorFunc<A>;
41
- };
42
- /** @internal */
43
- export type TimeoutMap<A> = {
44
- [name in keyof A]?: any;
45
- };
46
- export type NotifyFunc = (msg: string) => void;
47
- export type CloneFunction = <C>(obj: C) => C;
48
- export type ComparatorFunction = <C>(obj1: C, Obj2: C) => boolean;
49
- export type RetryOnErrorFunction = (error: any) => boolean;
50
- export type AsyncErrorHandler = (error: any, isHandled: boolean, state: any, props: any, actionName: string, args: any[]) => void;
51
- type DerivedStateMap<DS> = {
52
- [name in keyof DS]?: any[];
53
- };
54
- /** @internal */
55
- export type DerivedState<DS> = {
56
- state: DS;
57
- deps: DerivedStateMap<DS>;
58
- };
59
- export declare class EffectError extends Error {
60
- /**
61
- * The wrapped error
62
- */
63
- source: any;
64
- /**
65
- * If effects error occurred while processed an error, the initial error.
66
- */
67
- initialError: Error;
68
- constructor(source: any, initialError?: Error);
69
- }
70
- /**
71
- * Global configuration, shared with all stores.
72
- */
73
- export type GlobalConfig = {
74
- /**
75
- * Clone function.
76
- * Used to clone state and props when managing optimistic reducer and conflicting actions.
77
- * Default implementation is a very basic algorithm using JSON.stringify. To clone complex stats,
78
- * use a custom implementation like lodash/cloneDeep.
79
- * @default JSON.stringify
80
- */
81
- clone: CloneFunction;
82
- /**
83
- * Compare to objets and returns if they are equal.
84
- * Used to comparent previous and current state slice.
85
- * @default shallow
86
- */
87
- comparator: ComparatorFunction;
88
- /**
89
- * Global callback function to handle asychronous actions rejected promise.
90
- */
91
- asyncErrorHandler: AsyncErrorHandler;
92
- /**
93
- * Tests if the error will trigger a retry of the action or will fail directly.
94
- * Default implementation is returning true for TypeError instances only.
95
- * @see AsynchActionBase#retryCount
96
- */
97
- retryOnErrorFunction: RetryOnErrorFunction;
98
- /**
99
- * Global notification function that will called when an asynchronous action succeeded,
100
- * if and only if, an error message is specified for this action using
101
- * <code>getErrorMessage</code>.
102
- * If another function is set in the options, the function from the options will be used.
103
- */
104
- notifySuccess: NotifyFunc;
105
- /**
106
- * Global notification function that will called when an asynchronous action fails,
107
- * if and only if, an error message is specified for this action using
108
- * <code>getErrorMessage</code>.
109
- * If another function is set in the options, the function from the options will be used.
110
- */
111
- notifyError: NotifyFunc;
112
- /**
113
- * Global notification function that will injected in onDone and onFail of an asynchronous actions and onActionDone of a synchronous function,
114
- * If another function is set in the options, the function from the options will be used.
115
- */
116
- notifyWarning: NotifyFunc;
117
- /**
118
- * A default error message provider.
119
- * Used to return generic messages on generic HTTP errors
120
- */
121
- getErrorMessage: (error: Error) => string;
122
- /**
123
- * Default middlewares. Store middleware array will be concatenated with this one.
124
- * By default contains only the optimistic middleware.
125
- */
126
- defaultMiddlewares: MiddlewareFactory<any, any, any>[];
127
- };
128
- /** @internal */
129
- export declare const globalConfig: GlobalConfig;
130
- export declare function setGlobalConfig(overrideConfig: Partial<GlobalConfig>): void;
131
- /**
132
- * Type guard function to test if an action is a asynchronous action.
133
- */
134
- export declare function isAsyncAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncAction<S, F, A, P, DS, FxRes>;
135
- /**
136
- * Type guard function to test if an action is a synchronous action.
137
- */
138
- export declare function isSimpleSyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is SimpleSyncAction<S, F, P, DS, FxRes>;
139
- /**
140
- * Type guard function to test if an action is a synchronous action.
141
- */
142
- export declare function isSyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is SyncAction<S, F, A, P, DS, FxRes>;
143
- export declare function isAsyncGetPromiseAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncActionPromise<S, F, A, P, DS, FxRes>;
144
- export declare function isAsyncGetPromiseGetAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncActionPromiseGet<S, F, A, P, DS, FxRes>;
145
- /** @internal */
146
- export declare function computeAsyncActionInput<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: AsyncAction<S, F, A, P, DS, FxRes>): AsyncActionPromise<S, F, A, P, DS, FxRes>;
147
- /** @internal */
148
- export declare function buildLoadingMap<A>(source: InternalLoadingMap<A>, actionName: keyof A, promiseId: string, loading: boolean): InternalLoadingMap<A>;
149
- /** @internal */
150
- export declare function updateErrorMap<A>(source: ErrorParallelMap<A>, actionName: keyof A, promiseId: string, error: Error): ErrorParallelMap<A>;
151
- export declare class ParallelActionError extends Error {
152
- promiseIds: PromiseIdErrorMap;
153
- constructor(promiseIds: PromiseIdErrorMap);
154
- }
155
- export declare function buildErrorMap<A>(map: ErrorParallelMap<A>): ErrorMap<A>;
156
- /** @internal */
157
- export declare function retryPromiseDecorator<S, DS, F extends (...args: any[]) => Promise<any>, A, P>(promiseProvider: PromiseProvider<S, DS, F, A, P>, maxCalls?: number, delay?: number, isRetryError?: (e: Error) => boolean): PromiseProvider<S, DS, F, A, P>;
158
- export type Ref<P> = {
159
- current: P;
160
- };
161
- /** @internal */
162
- export declare function createRef<U>(init?: U): Ref<U>;
163
- /** @internal */
164
- export declare function buildInvocationContextBase<S, DS, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>): ContextWithDerived<S, DS, P>;
165
- /** @internal */
166
- export declare function buildOnMountInvocationContext<S, DS, A, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, actionsRef: Ref<A>): OnMountInvocationContext<S, A, P>;
167
- /** @internal */
168
- export declare function buildOnUnMountInvocationContext<S, DS, A, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, abortedActions: AbortedActions<A>): OnUnMountInvocationContext<S, A, P>;
169
- /** @internal */
170
- export declare function buildOnPropChangeEffects<S, DS, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, indices: number[], index: number, isInit: boolean, getInitialState: (p: P) => S): OnPropsChangeEffectsContext<S, DS, P>;
171
- /** @internal */
172
- export declare function addStateToContext<T, S>(ctx: T, stateRef: Ref<S>): T & ContextState<S>;
173
- /** @internal */
174
- export declare function addContextActions<T, A>(ctx: T, actionsRef: Ref<A>): T & InvocationContextActions<A>;
175
- /** @internal */
176
- export declare function isFuncConfig<S, A extends DecoratedActions, P = {}, DS = {}>(config: StoreConfig<S, A, P, DS>): config is StoreConfigFunc<S, A, P, DS>;
177
- /** @internal */
178
- export declare function decorateSimpleSyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(actionName: keyof A, action: SimpleSyncAction<S, F, P, DS>, stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, initializedRef: Ref<boolean>, options: StoreOptions<S, A, P, DS>, setState: SetStateFunc<S, A>): (...args: Parameters<F>) => void;
179
- /** @internal */
180
- export declare function decorateSyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(actionName: keyof A, action: SyncAction<S, F, A, P, DS>, stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, actionsRef: Ref<A>, initializedRef: Ref<boolean>, timeoutMap: Ref<TimeoutMap<A>>, options: StoreOptions<S, A, P, any>, setState: SetStateFunc<S, A>, clearError: ClearErrorFunc<A>): (...args: Parameters<F>) => void;
181
- /** @internal */
182
- export declare function decorateAsyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(context: AsyncActionExecContext<S, DS, F, A, P>): (...args: Parameters<F>) => Promise<any>;
183
- /** @internal */
184
- export declare function isLoadingImpl<A, K extends keyof A>(loadingMap: InternalLoadingMap<A>, ...props: (K | [K, string])[]): boolean;
185
- export declare const DEFAULT_PROMISE_ID = "__def__";
186
- /** @internal */
187
- export declare function areSameArgs(args1: any[], args2: any[]): boolean;
188
- /** @internal */
189
- export declare function computeDerivedValues<S, A, P, DS>(s: Ref<S>, p: Ref<P>, derivedStateRef: Ref<DerivedState<DS>>, options: StoreOptions<S, A, P, DS>): boolean;
190
- /** @internal */
191
- export declare function fixDerivedDeps<S, A, P, DS>(options: StoreOptions<S, A, P, DS>): void;
192
- /** @internal */
193
- export declare function onPropChange<S, P, A, DS>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, oldProps: P, actionsRef: Ref<A>, options: StoreOptions<S, A, P, DS>, getInitialState: (p: P) => S, setState: SetStateFunc<S, A>, isInit: boolean, isDeferred: boolean): void;
194
- /** @internal */
195
- export declare function runMiddlewares<S, A extends DecoratedActions, P>(middlewares: Middleware<S, A, P>[], oldState: S, newState: S, loading: boolean, actionName: keyof A, actionType: 'preEffects' | 'effects' | 'errorEffects' | null, isAsync: boolean, actionCtx: any): {
196
- newState: S;
197
- newLoading: boolean;
198
- };
199
- export {};
1
+ import { AsyncAction, SimpleSyncAction, SyncAction, StoreAction, AsyncActionPromise, AsyncActionPromiseGet, PromiseProvider, DecoratedActions, InternalLoadingMap, StoreOptions, InvocationContextActions, OnMountInvocationContext, OnPropsChangeEffectsContext, ContextState, Middleware, MiddlewareFactory, ContextWithDerived, PromiseIdErrorMap, ErrorMap, ErrorParallelMap, OnUnMountInvocationContext, AbortedActions, ClearErrorFunc, StoreConfig, StoreConfigFunc } from './types';
2
+ export type SetStateFunc<S, A> = (newState: S, newLoadingMap: InternalLoadingMap<A>, actionName: keyof A | 'onPropsChange', actionType: 'preEffects' | 'effects' | 'errorEffects' | null, // FIXME
3
+ isAsync: boolean, actionCtx: any, propsChanged: boolean, isInit?: boolean, disableNotify?: boolean) => () => void;
4
+ /** @internal */
5
+ export type PromiseMap<A> = {
6
+ [name in keyof A]?: {
7
+ [promiseId: string]: {
8
+ promise: Promise<any>;
9
+ refArgs: any[];
10
+ abortController: AbortController;
11
+ };
12
+ };
13
+ };
14
+ /** @internal */
15
+ export type FutureActions = {
16
+ args: any[];
17
+ resolve: (...args: any[]) => void;
18
+ reject: (...args: any[]) => void;
19
+ timestamp?: number;
20
+ };
21
+ /** @internal */
22
+ export type ConflictActionsMap<A> = {
23
+ [name in keyof A]?: FutureActions[];
24
+ };
25
+ /** @internal */
26
+ export type AsyncActionExecContext<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P> = {
27
+ actionName: keyof A;
28
+ action: AsyncActionPromise<S, F, A, P, DS>;
29
+ stateRef: Ref<S>;
30
+ derivedStateRef: Ref<DerivedState<DS>>;
31
+ propsRef: Ref<P>;
32
+ loadingParallelMapRef: Ref<InternalLoadingMap<A>>;
33
+ errorMapRef: Ref<ErrorParallelMap<A>>;
34
+ promisesRef: Ref<PromiseMap<A>>;
35
+ conflictActionsRef: Ref<ConflictActionsMap<A>>;
36
+ actionsRef: Ref<A>;
37
+ initializedRef: Ref<boolean>;
38
+ stateFlagRef: Ref<boolean>;
39
+ options: StoreOptions<S, A, P, any>;
40
+ setState: SetStateFunc<S, A>;
41
+ clearError: ClearErrorFunc<A>;
42
+ };
43
+ /** @internal */
44
+ export type TimeoutMap<A> = {
45
+ [name in keyof A]?: any;
46
+ };
47
+ export type NotifyFunc = (msg: string) => void;
48
+ export type CloneFunction = <C>(obj: C) => C;
49
+ export type ComparatorFunction = <C>(obj1: C, Obj2: C) => boolean;
50
+ export type RetryOnErrorFunction = (error: any) => boolean;
51
+ export type AsyncErrorHandler = (error: any, isHandled: boolean, state: any, props: any, actionName: string, args: any[]) => void;
52
+ type DerivedStateMap<DS> = {
53
+ [name in keyof DS]?: any[];
54
+ };
55
+ /** @internal */
56
+ export type DerivedState<DS> = {
57
+ state: DS;
58
+ deps: DerivedStateMap<DS>;
59
+ };
60
+ export declare class EffectError extends Error {
61
+ /**
62
+ * The wrapped error
63
+ */
64
+ source: any;
65
+ /**
66
+ * If effects error occurred while processed an error, the initial error.
67
+ */
68
+ initialError: Error;
69
+ constructor(source: any, initialError?: Error);
70
+ }
71
+ /**
72
+ * Global configuration, shared with all stores.
73
+ */
74
+ export type GlobalConfig = {
75
+ /**
76
+ * Clone function.
77
+ * Used to clone state and props when managing optimistic reducer and conflicting actions.
78
+ * Default implementation is a very basic algorithm using JSON.stringify. To clone complex stats,
79
+ * use a custom implementation like lodash/cloneDeep.
80
+ * @default JSON.stringify
81
+ */
82
+ clone: CloneFunction;
83
+ /**
84
+ * Compare to objets and returns if they are equal.
85
+ * Used to comparent previous and current state slice.
86
+ * @default shallow
87
+ */
88
+ comparator: ComparatorFunction;
89
+ /**
90
+ * Global callback function to handle asychronous actions rejected promise.
91
+ */
92
+ asyncErrorHandler: AsyncErrorHandler;
93
+ /**
94
+ * Tests if the error will trigger a retry of the action or will fail directly.
95
+ * Default implementation is returning true for TypeError instances only.
96
+ * @see AsynchActionBase#retryCount
97
+ */
98
+ retryOnErrorFunction: RetryOnErrorFunction;
99
+ /**
100
+ * First retry timeout. Every retry will wait x
101
+ */
102
+ autoRetryTimeout: number;
103
+ /**
104
+ * Number of retries in case of error (failed to fetch).
105
+ * If <code>0</code>, retry is globally disabled.
106
+ */
107
+ autoRetryCount: number;
108
+ /**
109
+ * Global notification function that will called when an asynchronous action succeeded,
110
+ * if and only if, an error message is specified for this action using
111
+ * <code>getErrorMessage</code>.
112
+ * If another function is set in the options, the function from the options will be used.
113
+ */
114
+ notifySuccess: NotifyFunc;
115
+ /**
116
+ * Global notification function that will called when an asynchronous action fails,
117
+ * if and only if, an error message is specified for this action using
118
+ * <code>getErrorMessage</code>.
119
+ * If another function is set in the options, the function from the options will be used.
120
+ */
121
+ notifyError: NotifyFunc;
122
+ /**
123
+ * Global notification function that will injected in onDone and onFail of an asynchronous actions and onActionDone of a synchronous function,
124
+ * If another function is set in the options, the function from the options will be used.
125
+ */
126
+ notifyWarning: NotifyFunc;
127
+ /**
128
+ * A default error message provider.
129
+ * Used to return generic messages on generic HTTP errors
130
+ */
131
+ getErrorMessage: (error: Error) => string;
132
+ /**
133
+ * Default middlewares. Store middleware array will be concatenated with this one.
134
+ * By default contains only the optimistic middleware.
135
+ */
136
+ defaultMiddlewares: MiddlewareFactory<any, any, any>[];
137
+ };
138
+ /** @internal */
139
+ export declare const globalConfig: GlobalConfig;
140
+ export declare function setGlobalConfig(overrideConfig: Partial<GlobalConfig>): void;
141
+ /**
142
+ * Type guard function to test if an action is a asynchronous action.
143
+ */
144
+ export declare function isAsyncAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncAction<S, F, A, P, DS, FxRes>;
145
+ /**
146
+ * Type guard function to test if an action is a synchronous action.
147
+ */
148
+ export declare function isSimpleSyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is SimpleSyncAction<S, F, P, DS, FxRes>;
149
+ /**
150
+ * Type guard function to test if an action is a synchronous action.
151
+ */
152
+ export declare function isSyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is SyncAction<S, F, A, P, DS, FxRes>;
153
+ export declare function isAsyncGetPromiseAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncActionPromise<S, F, A, P, DS, FxRes>;
154
+ export declare function isAsyncGetPromiseGetAction<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: StoreAction<S, F, A, P, DS, FxRes>): action is AsyncActionPromiseGet<S, F, A, P, DS, FxRes>;
155
+ /** @internal */
156
+ export declare function computeAsyncActionInput<S, DS, F extends (...args: any[]) => any, A, P, FxRes = S>(action: AsyncAction<S, F, A, P, DS, FxRes>): AsyncActionPromise<S, F, A, P, DS, FxRes>;
157
+ /** @internal */
158
+ export declare function buildLoadingMap<A>(source: InternalLoadingMap<A>, actionName: keyof A, promiseId: string, loading: boolean): InternalLoadingMap<A>;
159
+ /** @internal */
160
+ export declare function updateErrorMap<A>(source: ErrorParallelMap<A>, actionName: keyof A, promiseId: string, error: Error): ErrorParallelMap<A>;
161
+ export declare class ParallelActionError extends Error {
162
+ promiseIds: PromiseIdErrorMap;
163
+ constructor(promiseIds: PromiseIdErrorMap);
164
+ }
165
+ export declare function buildErrorMap<A>(map: ErrorParallelMap<A>): ErrorMap<A>;
166
+ /** @internal */
167
+ export declare function retryPromiseDecorator<S, DS, F extends (...args: any[]) => Promise<any>, A, P>(promiseProvider: PromiseProvider<S, DS, F, A, P>, maxCalls?: number, delay?: number, isRetryError?: (e: Error) => boolean): PromiseProvider<S, DS, F, A, P>;
168
+ export type Ref<P> = {
169
+ current: P;
170
+ };
171
+ /** @internal */
172
+ export declare function createRef<U>(init?: U): Ref<U>;
173
+ /** @internal */
174
+ export declare function buildInvocationContextBase<S, DS, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>): ContextWithDerived<S, DS, P>;
175
+ /** @internal */
176
+ export declare function buildOnMountInvocationContext<S, DS, A, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, actionsRef: Ref<A>): OnMountInvocationContext<S, A, P>;
177
+ /** @internal */
178
+ export declare function buildOnUnMountInvocationContext<S, DS, A, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, abortedActions: AbortedActions<A>): OnUnMountInvocationContext<S, A, P>;
179
+ /** @internal */
180
+ export declare function buildOnPropChangeEffects<S, DS, P>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, indices: number[], index: number, isInit: boolean, getInitialState: (p: P) => S): OnPropsChangeEffectsContext<S, DS, P>;
181
+ /** @internal */
182
+ export declare function addStateToContext<T, S>(ctx: T, stateRef: Ref<S>): T & ContextState<S>;
183
+ /** @internal */
184
+ export declare function addContextActions<T, A>(ctx: T, actionsRef: Ref<A>): T & InvocationContextActions<A>;
185
+ /** @internal */
186
+ export declare function isFuncConfig<S, A extends DecoratedActions, P = {}, DS = {}>(config: StoreConfig<S, A, P, DS>): config is StoreConfigFunc<S, A, P, DS>;
187
+ /** @internal */
188
+ export declare function decorateSimpleSyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(actionName: keyof A, action: SimpleSyncAction<S, F, P, DS>, stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, initializedRef: Ref<boolean>, options: StoreOptions<S, A, P, DS>, setState: SetStateFunc<S, A>): (...args: Parameters<F>) => void;
189
+ /** @internal */
190
+ export declare function decorateSyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(actionName: keyof A, action: SyncAction<S, F, A, P, DS>, stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, actionsRef: Ref<A>, initializedRef: Ref<boolean>, timeoutMap: Ref<TimeoutMap<A>>, options: StoreOptions<S, A, P, any>, setState: SetStateFunc<S, A>, clearError: ClearErrorFunc<A>): (...args: Parameters<F>) => void;
191
+ /** @internal */
192
+ export declare function decorateAsyncAction<S, DS, F extends (...args: any[]) => any, A extends DecoratedActions, P>(context: AsyncActionExecContext<S, DS, F, A, P>): (...args: Parameters<F>) => Promise<any>;
193
+ /** @internal */
194
+ export declare function isLoadingImpl<A, K extends keyof A>(loadingMap: InternalLoadingMap<A>, ...props: (K | [K, string])[]): boolean;
195
+ export declare const DEFAULT_PROMISE_ID = "__def__";
196
+ /** @internal */
197
+ export declare function areSameArgs(args1: any[], args2: any[]): boolean;
198
+ /** @internal */
199
+ export declare function computeDerivedValues<S, A, P, DS>(s: Ref<S>, p: Ref<P>, derivedStateRef: Ref<DerivedState<DS>>, options: StoreOptions<S, A, P, DS>): boolean;
200
+ /** @internal */
201
+ export declare function fixDerivedDeps<S, A, P, DS>(options: StoreOptions<S, A, P, DS>): void;
202
+ /** @internal */
203
+ export declare function onPropChange<S, P, A, DS>(stateRef: Ref<S>, derivedStateRef: Ref<DerivedState<DS>>, propsRef: Ref<P>, oldProps: P, actionsRef: Ref<A>, options: StoreOptions<S, A, P, DS>, getInitialState: (p: P) => S, setState: SetStateFunc<S, A>, isInit: boolean, isDeferred: boolean): void;
204
+ /** @internal */
205
+ export declare function runMiddlewares<S, A extends DecoratedActions, P>(middlewares: Middleware<S, A, P>[], oldState: S, newState: S, loading: boolean, actionName: keyof A, actionType: 'preEffects' | 'effects' | 'errorEffects' | null, isAsync: boolean, actionCtx: any): {
206
+ newState: S;
207
+ newLoading: boolean;
208
+ };
209
+ export {};
package/impl.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var t=function(){return t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};function n(e,r,t,n){return new(t||(t=Promise))((function(o,i){function c(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(c,a)}u((n=n.apply(e,r||[])).next())}))}function o(e,r){var t,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(c=0)),c;)try{if(t=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,n=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=r.call(e,c)}catch(e){a=[6,e],n=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}var c,a=function(){function e(e){this.keys=e,this.adj={}}return e.prototype.isCyclicUtil=function(e,r,t){var n;if(t.has(e))return!0;if(r.has(e))return!1;r.add(e),t.add(e);for(var o=0,i=null!==(n=this.adj[e])&&void 0!==n?n:[];o<i.length;o++){var c=i[o];if(this.isCyclicUtil(c,r,t))return!0}return t.delete(e),!1},e.prototype.setEdges=function(e,r){this.adj[e]=r},e.prototype.isCyclic=function(){for(var e=new Set,r=new Set,t=0,n=this.keys;t<n.length;t++){var o=n[t];if(this.isCyclicUtil(o,e,r))return!0}return!1},e}();!function(e){e.REJECT="reject",e.IGNORE="ignore",e.KEEP_LAST="keepLast",e.KEEP_ALL="keepAll",e.PARALLEL="parallel",e.REUSE="reuse",e.ABORT="abort"}(c||(c={}));var u=function(e){function t(r,n){var o=e.call(this,r.message)||this;return o.source=r,o.initialError=n,Object.setPrototypeOf(o,t.prototype),o}return r(t,e),t}(Error),s={clone:function(e){return JSON.parse(JSON.stringify(e))},comparator:function(e,r){if(Object.is(e,r))return!0;if("object"!=typeof e||null===e||"object"!=typeof r||null===r)return!1;if(e instanceof Set||r instanceof Set)return!1;var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var o=0;o<t.length;o++)if(!Object.prototype.hasOwnProperty.call(r,t[o])||!Object.is(e[t[o]],r[t[o]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(e){return e instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[]};function l(e){try{return s.clone(e)}catch(e){var r="StateDecorator: Cannot clone object. Set setCloneFunction on global global with another implementation like lodash/cloneDeep.";throw"development"===process.env.NODE_ENV&&(console.error(r),console.error(e.toString())),new Error(r)}}function f(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&e.hasOwnProperty("getGetPromise")}function d(e,r,n,o){var i,c,a,u;return t(t({},e),o?((i={})[r]=t(t({},e[r]||{}),((c={})[n]=o,c)),i):((a={})[r]=t(t({},e[r]),((u={})[n]=!1,u)),a))}function p(e,r,n,o){var i,c,a,u;return t(t({},e),o?((i={})[r]=t(t({},e[r]||{}),((c={})[n]=o,c)),i):((a={})[r]=t(t({},e[r]),((u={})[n]=void 0,u)),a))}var v=function(e){function t(r){var n=e.call(this,"Error")||this;return n.promiseIds=r,Object.setPrototypeOf(n,t.prototype),n}return r(t,e),t}(Error);function g(e,r,t,i){return void 0===r&&(r=1),void 0===t&&(t=1e3),void 0===i&&(i=function(){return!0}),1===r?e:function(c){var a=e(c);return null===a?null:function a(u,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return null===s?[2,null]:[2,s.catch((function(n){return i(n)?u===r?Promise.reject(n):new Promise((function(r,n){setTimeout((function(){var t=e(c);a(u+1,t).then(r).catch(n)}),t*u)})):Promise.reject(n)}))]}))}))}(1,a)}}function y(e){return void 0===e&&(e=null),{current:e}}function h(e,r,t){var n,o;return{state:e.current,s:e.current,ds:null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.state,derived:null===(o=null==r?void 0:r.current)||void 0===o?void 0:o.state,props:t.current,p:t.current}}function E(e,r,t,n,o,i,c){var a=h(e,r,t);return a.indices=n,a.index=o,a.isInit=i,a.getInitialState=c,a}function S(e,r,t,n,o){var i=h(e,r,t);return i.args=n,o&&(i.promiseId=o),i}function P(e,r,t,n,o,i){var c=S(e,r,t,n,i);return c.result=o,c.res=o,c}function m(e,r){var t=e;return t.state=r.current,t.s=r.current,t}function b(e,r){var t=e;return t.actions=r.current,t.a=r.current,t}function w(e,r,t,n,o,i){var c,a=b(e,n);m(e,r);var u=null===(c=null==t?void 0:t.current)||void 0===c?void 0:c.state;return a.derived=u,a.ds=u,a.notifyWarning=o,a.clearError=i,a}function x(e){"development"===process.env.NODE_ENV&&console.warn("[state-decorator] ".concat(e," action was called while store is not initialized or destroyed, this is probably a leak"))}function A(e,r,n){return n?r:null==r?null:t(t({},e.current),r)}function O(e,r,t,n,o,i,c,a,u,s,l){var f,d=P(t,n,o,l,void 0),p=!1;if(null!=r.effects){var v=A(t,r.effects(d),a.fullStateEffects);null===v?p=!0:u(v,void 0,e,"effects",!1,d,!1)}if(!p)if(r.debounceSideEffectsTimeout>0){var g=c.current[e];g&&clearTimeout(g),c.current[e]=setTimeout((function(){var o;null===(o=r.sideEffects)||void 0===o||o.call(r,w(d,t,n,i,a.notifyWarning,s)),delete c.current[e]}),r.debounceSideEffectsTimeout)}else null===(f=r.sideEffects)||void 0===f||f.call(r,w(d,t,n,i,a.notifyWarning,s))}function R(e,r,t,n){var o=e.action,i=e.stateRef,c=e.derivedStateRef,a=e.propsRef,l=e.actionsRef,f=e.loadingParallelMapRef,v=e.errorMapRef,g=e.promisesRef,y=e.conflictActionsRef,h=e.actionName,E=e.options,P=e.clearError,m=e.setState;if(e.initializedRef.current){var b=null,x=t,O=function(e,r,t,n,o,i){var c=S(e,r,t,n,i);return c.error=o,c.err=o,c}(i,c,a,n,x,r);if(o.errorEffects)try{b=A(i,o.errorEffects(O),E.fullStateEffects)}catch(e){x=new u(e,t)}v.current=p(v.current,h,r,x),m(b,d(f.current,h,r,!1),h,"errorEffects",!0,O,!1);var R=!1;(null!=b||o.errorSideEffects||o.isErrorManaged||E.isErrorManaged)&&(R=!0);var C=E.notifyError||s.notifyError;if(C){var j=void 0;o.getErrorMessage&&(j=o.getErrorMessage(O)),void 0===j&&!R&&s.getErrorMessage&&(j=s.getErrorMessage(x)),j&&(R=!0,C(j))}return s.asyncErrorHandler(x,R||o.rejectPromiseOnError,i.current,a.current,h,n),delete g.current[h][r],o.errorSideEffects&&o.errorSideEffects(w(O,i,c,l,s.notifyWarning,P)),L(e.initializedRef,h,l.current,y.current),!R||o.rejectPromiseOnError?Promise.reject(x):Promise.resolve()}}var C="__def__";function j(e,r){return e.length===r.length&&-1===e.findIndex((function(e,t){return r[t]!==e}))}function L(e,r,t,n){if(e.current){var o=n[r];if((null==o?void 0:o.length)>0){var i=o.shift();if(i){var c=t[r].apply(t,i.args);null==c?L(e,r,t,n):c.then((function(o){null===o&&L(e,r,t,n),i.resolve(o)})).catch((function(e){return i.reject(e)}))}}}}exports.DEFAULT_PROMISE_ID=C,exports.EffectError=u,exports.ParallelActionError=v,exports.addContextActions=b,exports.addStateToContext=m,exports.areSameArgs=j,exports.buildErrorMap=function(e){return Object.keys(e).reduce((function(r,t){var n=e[t];if(null==n[C]);else if(n[C])r[t]=n[C];else{var o=Object.keys(n).reduce((function(e,r){return null!=n[r]&&(e.hasErr=!0,e.map[r]=n[r]),e}),{hasErr:!1,map:{}});o.hasErr&&(r[t]=new v(o.map))}return r}),{})},exports.buildInvocationContextBase=h,exports.buildLoadingMap=d,exports.buildOnMountInvocationContext=function(e,r,t,n){return b(h(e,r,t),n)},exports.buildOnPropChangeEffects=E,exports.buildOnUnMountInvocationContext=function(e,r,n,o){return t(t({},h(e,r,n)),{abortedActions:o})},exports.computeAsyncActionInput=function(e){return e.conflictPolicy===c.ABORT&&(e.abortable=!0),f(e)?t(t({},e),{getPromise:e.getGetPromise,retryCount:3,conflictPolicy:c.REUSE}):e},exports.computeDerivedValues=function(e,r,n,o){if(null==(null==o?void 0:o.derivedState))return!1;var i=!1,c=s.comparator,a=n.current.deps,u=h(e,null,r),l=Object.keys(o.derivedState);return n.current.state=l.reduce((function(e,r){var s,l,f=!1,d=o.derivedState[r],p=a[r],v=null!==(l=null===(s=d.getDeps)||void 0===s?void 0:s.call(d,u))&&void 0!==l?l:[];(d.derivedDeps&&d.derivedDeps.forEach((function(r){var t,o,i;return v.push(null!==(t=e[r])&&void 0!==t?t:null===(i=null===(o=n.current)||void 0===o?void 0:o.state)||void 0===i?void 0:i[r])})),null==p)?f=!0:f=-1!==v.findIndex((function(e,r){return p.length<r||!c(p[r],e)}));return i=i||f,a[r]=v,e[r]=f?o.derivedState[r].get(function(e,r){return t(t({},e),{ds:r,derived:r})}(u,e)):n.current.state[r],e}),{}),i},exports.createRef=y,exports.decorateAsyncAction=function(e){var r=e.action,n=e.stateRef,o=e.derivedStateRef,a=e.propsRef,f=e.actionsRef,v=e.promisesRef,y=e.loadingParallelMapRef,h=e.errorMapRef,E=e.initializedRef,m=e.conflictActionsRef,O=e.actionName,M=e.setState,_=e.options;return function(){for(var T,k,D,I=[],G=0;G<arguments.length;G++)I[G]=arguments[G];if(!E.current)return x(O),null;var N=v.current,U=r.conflictPolicy,z=void 0===U?c.KEEP_ALL:U,F=z===c.PARALLEL,K=null;if(F){if(!r.getPromiseId)throw new Error("If conflict policy is set to ConflictPolicy.PARALLEL, getPromiseId must be set and return a string.");K=r.getPromiseId.apply(r,I)}else K=C;if(!F&&(null===(k=N[O])||void 0===k?void 0:k[K])){var W=function(e,r,t,n,o){var i=n;if(i===c.REUSE){if(j(e[t][C].refArgs,o))return e[t][C].promise;i=c.KEEP_ALL}return new Promise((function(n,a){var u,s={resolve:n,reject:a,args:l(o),timestamp:Date.now()};switch(i){case c.IGNORE:n(void 0);break;case c.REJECT:a(new Error("An asynchronous action ".concat(t," is already ongoing.")));break;case c.KEEP_LAST:r[t]=[s];break;case c.ABORT:var f=null===(u=e[t][C])||void 0===u?void 0:u.abortController;null==f||f.abort("conflict");case c.KEEP_ALL:var d=r[t];d||(r[t]=d=[]),d.push(s);case c.PARALLEL:case c.REUSE:}}))}(N,m.current,O,z,I);return W}var B=null,J=!1,H=S(n,o,a,I,K);if(r.preEffects){try{B=A(n,r.preEffects(H),_.fullStateEffects)}catch(e){return s.asyncErrorHandler(new u(e),!1,n.current,a.current,O,I),Promise.reject(new u(e))}B&&(J=!0,n.current=B)}var V=r.abortable,q=r.retryCount,Q=r.retryDelaySeed,X=r.isTriggerRetryError,Y=V&&window.AbortController?new AbortController:null,Z=null===(D=g(r.getPromise,q?1+q:1,Q,X||s.retryOnErrorFunction)(function(e,r,t,n,o,i,c){var a=b(S(e,r,t,n,c),o);return a.abortSignal=i,a}(n,o,a,I,f,null==Y?void 0:Y.signal)))||void 0===D?void 0:D.then((function(r){return function(e,r,t,n){var o=e.action,i=e.stateRef,c=e.derivedStateRef,a=e.propsRef,l=e.promisesRef,f=e.actionsRef,p=e.loadingParallelMapRef,v=e.conflictActionsRef,g=e.actionName,y=e.options,h=e.setState,E=e.clearError;if(e.initializedRef.current){var S=null,m=P(i,c,a,n,t,r);if(o.effects)try{S=A(i,o.effects(m),y.fullStateEffects)}catch(e){return Promise.reject(new u(e))}h(S,d(p.current,g,r,!1),g,"effects",!0,m,!1);var b=y.notifySuccess||s.notifySuccess;if(b){var x=void 0;o.getSuccessMessage&&(x=o.getSuccessMessage(m)),x&&b(x)}return delete l.current[g][r],o.sideEffects&&o.sideEffects(w(m,i,c,f,s.notifyWarning,E)),L(e.initializedRef,g,f.current,v.current),t}}(e,K,r,I)})).catch((function(r){return R(e,K,r,I)}));return null!=Z&&(N[O]=t(t({},N[O]||{}),((T={})[K||C]={abortController:Y,promise:Z,refArgs:z===c.REUSE&&I.length>0?i([],I,!0):[]},T))),h.current=p(h.current,O,K,null),M(null!=Z||J?n.current:void 0,null==Z?void 0:d(y.current,O,K,!0),O,"preEffects",!0,H,!1),Z}},exports.decorateSimpleSyncAction=function(e,r,t,n,o,i,c,a){return function(){for(var u=[],s=0;s<arguments.length;s++)u[s]=arguments[s];if(i.current){var l=S(t,n,o,u),f=A(t,r(l),c.fullStateEffects);a(f,null,e,"effects",!1,l,!1)}else x(e)}},exports.decorateSyncAction=function(e,r,t,n,o,i,c,a,u,s,l){return function(){for(var f=[],d=0;d<arguments.length;d++)f[d]=arguments[d];if(c.current)if(r.debounceTimeout){var p=a.current[e];p&&clearTimeout(p),a.current[e]=setTimeout((function(){delete a.current[e],O(e,r,t,n,o,i,a,u,s,l,f)}),r.debounceTimeout)}else O(e,r,t,n,o,i,a,u,s,l,f);else x(e)}},exports.fixDerivedDeps=function(e){var r,t=Object.keys(e.derivedState),n=new a(t);if(t.forEach((function(r){n.setEdges(r,e.derivedState[r].derivedDeps)})),n.isCyclic())throw new Error("There are cycles in the derived state dependencies");for(var o=!1,i={},c=0,u=t;c<u.length;c++){var s=u[c],l=null!==(r=e.derivedState[s].derivedDeps)&&void 0!==r?r:[];o=o||l.length>0,i[s]=l.concat()}if(o){t.sort((function(e,r){return i[e].length-i[r].length}));for(var f=[],d=new Set,p=t.length;d.size!==p;){var v=t.pop();if(!d.has(v))i[v]=i[v].filter((function(e){return!d.has(e)})),0===i[v].length?(f.push(v),d.add(v)):t.splice(0,0,v)}for(var g={},y=0,h=f;y<h.length;y++){g[v=h[y]]=e.derivedState[v]}e.derivedState=g}},exports.globalConfig=s,exports.isAsyncAction=function(e){return!(e instanceof Function)&&(e.hasOwnProperty("getPromise")||e.hasOwnProperty("getGetPromise"))},exports.isAsyncGetPromiseAction=function(e){return"function"!=typeof e&&e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.isAsyncGetPromiseGetAction=f,exports.isFuncConfig=function(e){return e.hasOwnProperty("getInitialState")},exports.isLoadingImpl=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return r.some((function(r){var t,n=null,o=C;Array.isArray(r)?(n=r[0],o=void 0===(t=r[1])?C:t):n=r;var i=e[n];return null!=i&&(null!=i[o]&&i[o])}))},exports.isSimpleSyncAction=function(e){return"function"==typeof e},exports.isSyncAction=function(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.onPropChange=function(e,r,n,o,i,c,a,u,l,f){var d=null!=(null==c?void 0:c.derivedState);if(null!=c.onPropsChange){var p;p=Array.isArray(c.onPropsChange)?c.onPropsChange:[c.onPropsChange];var v=!1,g=y(e.current),h=[],S=s.comparator;p.forEach((function(t,i){var s,d=t.getDeps;if(d){var p=!1,y=[];if(l){if(!(!f&&t.onMount||f&&t.onMountDeferred))return;p=!0}else{var P=d(o),m=d(n.current);P.length!==m.length?(console.warn("options.onPropsChange.getDeps returned array must be stable (same length)"),p=!0):P.forEach((function(e,r){S(e,m[r])||(p=!0,y.push(r))}))}if(p){var b=E(g,r,n,y,i,l,a),w=A(e,null===(s=t.effects)||void 0===s?void 0:s.call(t,b),c.fullStateEffects);null!=w&&(v=!0,g.current=w,u(g.current,void 0,"onPropsChange","effects",!1,b,!0,l)),t.sideEffects&&h.push({index:i,indices:y,ctx:b})}}})),!v&&d&&u(void 0,void 0,"onPropsChange","effects",!1,null,!0),h.length>0&&h.forEach((function(e){p[e.index].sideEffects(t(t({},m(b(e.ctx,i),g)),{indices:e.indices}))}))}else null!=(null==c?void 0:c.derivedState)&&u(void 0,void 0,"onPropsChange","effects",!1,null,!0)},exports.retryPromiseDecorator=g,exports.runMiddlewares=function(e,r,t,n,o,i,c,a){if("onPropsChange"===o&&void 0===t)return{newState:null,newLoading:!1};if(e&&e.length>0){var u=e.reduce((function(e,r){var t=r.effects({isAsync:c,name:o,type:i,context:a},e.oldState,e.newState,n);return{newState:(null==t?void 0:t.state)||e.newState,oldState:(null==t?void 0:t.state)?e.newState:e.oldState,loading:null==(null==t?void 0:t.loading)?e.loading:t.loading}}),{oldState:r,newState:t,loading:n});return{newLoading:u.loading,newState:u.newState}}return{newState:t,newLoading:n}},exports.setGlobalConfig=function(e){Object.keys(e).forEach((function(r){null!=e[r]&&(s[r]=e[r])}))},exports.updateErrorMap=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var t=function(){return t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};function n(e,r,t,n){return new(t||(t=Promise))((function(o,i){function c(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(c,a)}u((n=n.apply(e,r||[])).next())}))}function o(e,r){var t,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(c=0)),c;)try{if(t=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,n=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=r.call(e,c)}catch(e){a=[6,e],n=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var c,a=function(){function e(e){this.keys=e,this.adj={}}return e.prototype.isCyclicUtil=function(e,r,t){var n;if(t.has(e))return!0;if(r.has(e))return!1;r.add(e),t.add(e);for(var o=0,i=null!==(n=this.adj[e])&&void 0!==n?n:[];o<i.length;o++){var c=i[o];if(this.isCyclicUtil(c,r,t))return!0}return t.delete(e),!1},e.prototype.setEdges=function(e,r){this.adj[e]=r},e.prototype.isCyclic=function(){for(var e=new Set,r=new Set,t=0,n=this.keys;t<n.length;t++){var o=n[t];if(this.isCyclicUtil(o,e,r))return!0}return!1},e}();!function(e){e.REJECT="reject",e.IGNORE="ignore",e.KEEP_LAST="keepLast",e.KEEP_ALL="keepAll",e.PARALLEL="parallel",e.REUSE="reuse",e.ABORT="abort"}(c||(c={}));var u=function(e){function t(r,n){var o=e.call(this,r.message)||this;return o.source=r,o.initialError=n,Object.setPrototypeOf(o,t.prototype),o}return r(t,e),t}(Error),l={clone:function(e){return JSON.parse(JSON.stringify(e))},comparator:function(e,r){if(Object.is(e,r))return!0;if("object"!=typeof e||null===e||"object"!=typeof r||null===r)return!1;if(e instanceof Set||r instanceof Set)return!1;var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var o=0;o<t.length;o++)if(!Object.prototype.hasOwnProperty.call(r,t[o])||!Object.is(e[t[o]],r[t[o]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(e){return e instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[],autoRetryCount:void 0,autoRetryTimeout:void 0};function s(e){try{return l.clone(e)}catch(e){var r="StateDecorator: Cannot clone object. Set setCloneFunction on global global with another implementation like lodash/cloneDeep.";throw"development"===process.env.NODE_ENV&&(console.error(r),console.error(e.toString())),new Error(r)}}function f(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&e.hasOwnProperty("getGetPromise")}function d(e,r,n,o){var i,c,a,u;return t(t({},e),o?((i={})[r]=t(t({},e[r]||{}),((c={})[n]=o,c)),i):((a={})[r]=t(t({},e[r]),((u={})[n]=!1,u)),a))}function p(e,r,n,o){var i,c,a,u;return t(t({},e),o?((i={})[r]=t(t({},e[r]||{}),((c={})[n]=o,c)),i):((a={})[r]=t(t({},e[r]),((u={})[n]=void 0,u)),a))}var v=function(e){function t(r){var n=e.call(this,"Error")||this;return n.promiseIds=r,Object.setPrototypeOf(n,t.prototype),n}return r(t,e),t}(Error);function y(e,r,t,i){return void 0===r&&(r=1),void 0===t&&(t=1e3),void 0===i&&(i=function(){return!0}),1===r?e:function(c){var a=e(c);return null===a?null:function a(u,l){return n(this,void 0,void 0,(function(){return o(this,(function(n){return null===l?[2,null]:[2,l.catch((function(n){return i(n)?u===r?Promise.reject(n):new Promise((function(r,n){setTimeout((function(){var t=e(c);a(u+1,t).then(r).catch(n)}),t*u)})):Promise.reject(n)}))]}))}))}(1,a)}}function g(e){return void 0===e&&(e=null),{current:e}}function h(e,r,t){var n,o;return{state:e.current,s:e.current,ds:null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.state,derived:null===(o=null==r?void 0:r.current)||void 0===o?void 0:o.state,props:t.current,p:t.current}}function E(e,r,t,n,o,i,c){var a=h(e,r,t);return a.indices=n,a.index=o,a.isInit=i,a.getInitialState=c,a}function S(e,r,t,n,o){var i=h(e,r,t);return i.args=n,o&&(i.promiseId=o),i}function m(e,r,t,n,o,i){var c=S(e,r,t,n,i);return c.result=o,c.res=o,c}function P(e,r){var t=e;return t.state=r.current,t.s=r.current,t}function b(e,r){var t=e;return t.actions=r.current,t.a=r.current,t}function w(e,r,t,n,o,i){var c,a=b(e,n);P(e,r);var u=null===(c=null==t?void 0:t.current)||void 0===c?void 0:c.state;return a.derived=u,a.ds=u,a.notifyWarning=o,a.clearError=i,a}function x(e){"development"===process.env.NODE_ENV&&console.warn("[state-decorator] ".concat(e," action was called while store is not initialized or destroyed, this is probably a leak"))}function A(e,r,n){return n?r:null==r?null:t(t({},e.current),r)}function R(e,r,t,n,o,i,c,a,u,l,s,f){var d,p=m(t,n,o,f,void 0),v=!1;if(null!=r.effects){var y=A(t,r.effects(p),u.fullStateEffects);null===y?v=!0:l(y,void 0,e,"effects",!1,p,!1)}if(!v)if(r.debounceSideEffectsTimeout>0){var g=c.current[e];g&&clearTimeout(g),c.current[e]=setTimeout((function(){var o;a.current&&(null===(o=r.sideEffects)||void 0===o||o.call(r,w(p,t,n,i,u.notifyWarning,s)),delete c.current[e])}),r.debounceSideEffectsTimeout)}else null===(d=r.sideEffects)||void 0===d||d.call(r,w(p,t,n,i,u.notifyWarning,s))}function O(e,r,t,n){var o=e.action,i=e.stateRef,c=e.derivedStateRef,a=e.propsRef,s=e.actionsRef,f=e.loadingParallelMapRef,v=e.errorMapRef,y=e.promisesRef,g=e.conflictActionsRef,h=e.actionName,E=e.options,m=e.clearError,P=e.setState;if(e.initializedRef.current){var b=null,x=t,R=function(e,r,t,n,o,i){var c=S(e,r,t,n,i);return c.error=o,c.err=o,c}(i,c,a,n,x,r);if(o.errorEffects)try{b=A(i,o.errorEffects(R),E.fullStateEffects)}catch(e){x=new u(e,t)}v.current=p(v.current,h,r,x),P(b,d(f.current,h,r,!1),h,"errorEffects",!0,R,!1);var O=!1;(null!=b||o.errorSideEffects||o.isErrorManaged||E.isErrorManaged)&&(O=!0);var C=E.notifyError||l.notifyError;if(C){var j=void 0;o.getErrorMessage&&(j=o.getErrorMessage(R)),void 0===j&&!O&&l.getErrorMessage&&(j=l.getErrorMessage(x)),j&&(O=!0,C(j))}return l.asyncErrorHandler(x,O||o.rejectPromiseOnError,i.current,a.current,h,n),delete y.current[h][r],o.errorSideEffects&&o.errorSideEffects(w(R,i,c,s,l.notifyWarning,m)),L(e.initializedRef,h,s.current,g.current),!O||o.rejectPromiseOnError?Promise.reject(x):Promise.resolve()}}var C="__def__";function j(e,r){return e.length===r.length&&-1===e.findIndex((function(e,t){return r[t]!==e}))}function L(e,r,t,n){if(e.current){var o=n[r];if((null==o?void 0:o.length)>0){var i=o.shift();if(i){var c=t[r].apply(t,i.args);null==c?L(e,r,t,n):c.then((function(o){null===o&&L(e,r,t,n),i.resolve(o)})).catch((function(e){return i.reject(e)}))}}}}exports.DEFAULT_PROMISE_ID=C,exports.EffectError=u,exports.ParallelActionError=v,exports.addContextActions=b,exports.addStateToContext=P,exports.areSameArgs=j,exports.buildErrorMap=function(e){return Object.keys(e).reduce((function(r,t){var n=e[t];if(null==n[C]);else if(n[C])r[t]=n[C];else{var o=Object.keys(n).reduce((function(e,r){return null!=n[r]&&(e.hasErr=!0,e.map[r]=n[r]),e}),{hasErr:!1,map:{}});o.hasErr&&(r[t]=new v(o.map))}return r}),{})},exports.buildInvocationContextBase=h,exports.buildLoadingMap=d,exports.buildOnMountInvocationContext=function(e,r,t,n){return b(h(e,r,t),n)},exports.buildOnPropChangeEffects=E,exports.buildOnUnMountInvocationContext=function(e,r,n,o){return t(t({},h(e,r,n)),{abortedActions:o})},exports.computeAsyncActionInput=function(e){var r,n,o;return e.conflictPolicy===c.ABORT&&(e.abortable=!0),f(e)?t(t({},e),{getPromise:e.getGetPromise,retryDelaySeed:null!==(r=l.autoRetryTimeout)&&void 0!==r?r:1e3,retryCount:null!==(n=l.autoRetryCount)&&void 0!==n?n:3,conflictPolicy:null!==(o=e.conflictPolicy)&&void 0!==o?o:c.REUSE}):e},exports.computeDerivedValues=function(e,r,n,o){if(null==(null==o?void 0:o.derivedState))return!1;var i=!1,c=l.comparator,a=n.current.deps,u=h(e,null,r),s=Object.keys(o.derivedState);return n.current.state=s.reduce((function(e,r){var l,s,f=!1,d=o.derivedState[r],p=a[r],v=null!==(s=null===(l=d.getDeps)||void 0===l?void 0:l.call(d,u))&&void 0!==s?s:[];(d.derivedDeps&&d.derivedDeps.forEach((function(r){var t,o,i;return v.push(null!==(t=e[r])&&void 0!==t?t:null===(i=null===(o=n.current)||void 0===o?void 0:o.state)||void 0===i?void 0:i[r])})),null==p)?f=!0:f=-1!==v.findIndex((function(e,r){return p.length<r||!c(p[r],e)}));return i=i||f,a[r]=v,e[r]=f?o.derivedState[r].get(function(e,r){return t(t({},e),{ds:r,derived:r})}(u,e)):n.current.state[r],e}),{}),i},exports.createRef=g,exports.decorateAsyncAction=function(e){var r=e.action,n=e.stateRef,o=e.derivedStateRef,a=e.propsRef,f=e.actionsRef,v=e.promisesRef,g=e.loadingParallelMapRef,h=e.errorMapRef,E=e.initializedRef,P=e.conflictActionsRef,R=e.actionName,M=e.setState,T=e.options;return function(){for(var _,D,k,I=[],G=0;G<arguments.length;G++)I[G]=arguments[G];if(!E.current)return x(R),null;var N=v.current,U=r.conflictPolicy,z=void 0===U?c.KEEP_ALL:U,F=z===c.PARALLEL,K=null;if(F){if(!r.getPromiseId)throw new Error("If conflict policy is set to ConflictPolicy.PARALLEL, getPromiseId must be set and return a string.");K=r.getPromiseId.apply(r,I)}else K=C;if(!F&&(null===(D=N[R])||void 0===D?void 0:D[K])){var W=function(e,r,t,n,o){var i=n;if(i===c.REUSE){if(j(e[t][C].refArgs,o))return e[t][C].promise;i=c.KEEP_ALL}return new Promise((function(n,a){var u,l={resolve:n,reject:a,args:s(o),timestamp:Date.now()};switch(i){case c.IGNORE:n(void 0);break;case c.REJECT:a(new Error("An asynchronous action ".concat(t," is already ongoing.")));break;case c.KEEP_LAST:r[t]=[l];break;case c.ABORT:var f=null===(u=e[t][C])||void 0===u?void 0:u.abortController;null==f||f.abort("conflict");case c.KEEP_ALL:var d=r[t];d||(r[t]=d=[]),d.push(l);case c.PARALLEL:}}))}(N,P.current,R,z,I);return W}var B=null,J=!1,H=S(n,o,a,I,K);if(r.preEffects){try{B=A(n,r.preEffects(H),T.fullStateEffects)}catch(e){return l.asyncErrorHandler(new u(e),!1,n.current,a.current,R,I),Promise.reject(new u(e))}B&&(J=!0,n.current=B)}var V=r.abortable,q=r.retryCount,Q=r.retryDelaySeed,X=r.isTriggerRetryError,Y=V&&window.AbortController?new AbortController:null,Z=null===(k=y(r.getPromise,q?1+q:1,Q,X||l.retryOnErrorFunction)(function(e,r,t,n,o,i,c){var a=b(S(e,r,t,n,c),o);return a.abortSignal=i,a}(n,o,a,I,f,null==Y?void 0:Y.signal)))||void 0===k?void 0:k.then((function(r){return function(e,r,t,n){var o=e.action,i=e.stateRef,c=e.stateFlagRef,a=e.derivedStateRef,s=e.propsRef,f=e.promisesRef,p=e.actionsRef,v=e.loadingParallelMapRef,y=e.conflictActionsRef,g=e.actionName,h=e.options,E=e.setState,S=e.clearError;if(e.initializedRef.current){var P=null,b=m(i,a,s,n,t,r);if(o.effects)try{P=A(i,o.effects(b),h.fullStateEffects)}catch(e){return Promise.reject(new u(e))}c.current=!1;var x=E(P,d(v.current,g,r,!1),g,"effects",!0,b,!1,!1,!0),R=h.notifySuccess||l.notifySuccess;if(R){var O=void 0;o.getSuccessMessage&&(O=o.getSuccessMessage(b)),O&&R(O)}return delete f.current[g][r],o.sideEffects&&o.sideEffects(w(b,i,a,p,l.notifyWarning,S)),c.current||x(),L(e.initializedRef,g,p.current,y.current),t}}(e,K,r,I)})).catch((function(r){return O(e,K,r,I)}));return null!=Z&&(N[R]=t(t({},N[R]||{}),((_={})[K||C]={abortController:Y,promise:Z,refArgs:z===c.REUSE&&I.length>0?i([],I,!0):[]},_))),h.current=p(h.current,R,K,null),M(null!=Z||J?n.current:void 0,null==Z?void 0:d(g.current,R,K,!0),R,"preEffects",!0,H,!1),Z}},exports.decorateSimpleSyncAction=function(e,r,t,n,o,i,c,a){return function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];if(i.current){var s=S(t,n,o,u),f=A(t,r(s),c.fullStateEffects);a(f,null,e,"effects",!1,s,!1)}else x(e)}},exports.decorateSyncAction=function(e,r,t,n,o,i,c,a,u,l,s){return function(){for(var f=[],d=0;d<arguments.length;d++)f[d]=arguments[d];if(c.current)if(r.debounceTimeout){var p=a.current[e];p&&clearTimeout(p),a.current[e]=setTimeout((function(){c.current&&(delete a.current[e],R(e,r,t,n,o,i,a,c,u,l,s,f))}),r.debounceTimeout)}else R(e,r,t,n,o,i,a,c,u,l,s,f);else x(e)}},exports.fixDerivedDeps=function(e){var r,t=Object.keys(e.derivedState),n=new a(t);if(t.forEach((function(r){n.setEdges(r,e.derivedState[r].derivedDeps)})),n.isCyclic())throw new Error("There are cycles in the derived state dependencies");for(var o=!1,i={},c=0,u=t;c<u.length;c++){var l=u[c],s=null!==(r=e.derivedState[l].derivedDeps)&&void 0!==r?r:[];o=o||s.length>0,i[l]=s.concat()}if(o){t.sort((function(e,r){return i[e].length-i[r].length}));for(var f=[],d=new Set,p=t.length;d.size!==p;){var v=t.pop();if(!d.has(v))i[v]=i[v].filter((function(e){return!d.has(e)})),0===i[v].length?(f.push(v),d.add(v)):t.splice(0,0,v)}for(var y={},g=0,h=f;g<h.length;g++){y[v=h[g]]=e.derivedState[v]}e.derivedState=y}},exports.globalConfig=l,exports.isAsyncAction=function(e){return!(e instanceof Function)&&(e.hasOwnProperty("getPromise")||e.hasOwnProperty("getGetPromise"))},exports.isAsyncGetPromiseAction=function(e){return"function"!=typeof e&&e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.isAsyncGetPromiseGetAction=f,exports.isFuncConfig=function(e){return e.hasOwnProperty("getInitialState")},exports.isLoadingImpl=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return r.some((function(r){var t,n=null,o=C;Array.isArray(r)?(n=r[0],o=void 0===(t=r[1])?C:t):n=r;var i=e[n];return null!=i&&(null!=i[o]&&i[o])}))},exports.isSimpleSyncAction=function(e){return"function"==typeof e},exports.isSyncAction=function(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.onPropChange=function(e,r,n,o,i,c,a,u,s,f){var d=null!=(null==c?void 0:c.derivedState);if(null!=c.onPropsChange){var p;p=Array.isArray(c.onPropsChange)?c.onPropsChange:[c.onPropsChange];var v=!1,y=g(e.current),h=[],S=l.comparator;p.forEach((function(t,i){var l,d=t.getDeps;if(d){var p=!1,g=[];if(s){if(!(!f&&t.onMount||f&&t.onMountDeferred))return;p=!0}else{var m=d(o),P=d(n.current);m.length!==P.length?(console.warn("options.onPropsChange.getDeps returned array must be stable (same length)"),p=!0):m.forEach((function(e,r){S(e,P[r])||(p=!0,g.push(r))}))}if(p){var b=E(y,r,n,g,i,s,a),w=A(e,null===(l=t.effects)||void 0===l?void 0:l.call(t,b),c.fullStateEffects);null!=w&&(v=!0,y.current=w,u(y.current,void 0,"onPropsChange","effects",!1,b,!0,s)),t.sideEffects&&h.push({index:i,indices:g,ctx:b})}}})),!v&&d&&u(void 0,void 0,"onPropsChange","effects",!1,null,!0),h.length>0&&h.forEach((function(e){p[e.index].sideEffects(t(t({},P(b(e.ctx,i),y)),{indices:e.indices}))}))}else null!=(null==c?void 0:c.derivedState)&&u(void 0,void 0,"onPropsChange","effects",!1,null,!0)},exports.retryPromiseDecorator=y,exports.runMiddlewares=function(e,r,t,n,o,i,c,a){if("onPropsChange"===o&&void 0===t)return{newState:null,newLoading:!1};if(e&&e.length>0){var u=e.reduce((function(e,r){var t=r.effects({isAsync:c,name:o,type:i,context:a},e.oldState,e.newState,n);return{newState:(null==t?void 0:t.state)||e.newState,oldState:(null==t?void 0:t.state)?e.newState:e.oldState,loading:null==(null==t?void 0:t.loading)?e.loading:t.loading}}),{oldState:r,newState:t,loading:n});return{newLoading:u.loading,newState:u.newState}}return{newState:t,newLoading:n}},exports.setGlobalConfig=function(e){Object.keys(e).forEach((function(r){null!=e[r]&&(l[r]=e[r])}))},exports.updateErrorMap=p;
2
2
  //# sourceMappingURL=impl.js.map