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/es/v5_types.d.ts CHANGED
@@ -1,213 +1,213 @@
1
- import { ConflictPolicy, DecoratedActions, NotifyFunc, PromiseResult } from './types';
2
- export type PromiseProvider<S, F extends (...args: any[]) => any, A, P> = (args: Parameters<F>, state: S, props: P, actions: A, abortSignal: AbortSignal) => ReturnType<F> | null;
3
- /**
4
- * Simple form of a synchronous action.
5
- */
6
- export type SynchAction<S, F extends (...args: any[]) => any, P> = (state: S, args: Parameters<F>, props: P) => S | null;
7
- /**
8
- * Advanced synchronous action.
9
- * Allows to set advanced properties to a synchronous action.
10
- */
11
- export type AdvancedSynchAction<S, F extends (...args: any[]) => any, A, P> = {
12
- /**
13
- * The action to execute.
14
- */
15
- action: (state: S, args: Parameters<F>, props: P) => S | null;
16
- /**
17
- * Debounces the side effects if this parameter is defined.
18
- */
19
- debounceSideEffectsTimeout?: number;
20
- /**
21
- * Debounces the action if this parameter is defined.
22
- */
23
- debounceTimeout?: number;
24
- /**
25
- * Action to call when the action is done. Used to trigger other actions (even asynchronous),
26
- */
27
- onActionDone?: (state: S, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
28
- };
29
- export type PromiseIdMap = {
30
- [promiseId: string]: boolean;
31
- };
32
- export type InternalLoadingMap<A> = {
33
- [name: string]: undefined | boolean | PromiseIdMap;
34
- };
35
- export type LoadingMap<A> = {
36
- [P in keyof A]?: undefined | boolean;
37
- };
38
- export type LoadingMapParallelActions<A> = {
39
- [P in keyof A]?: PromiseIdMap;
40
- };
41
- export type LoadingProps<A> = {
42
- loading: boolean;
43
- loadingMap: LoadingMap<A>;
44
- loadingParallelMap: LoadingMapParallelActions<A>;
45
- };
46
- /**
47
- * Try to abort an action, if the action is <code>abortable</code>.
48
- * @param actionName The action name
49
- * @param promiseId If the action conflict type is <code>ConflictType.PARALLEL</code>, the identifier of the promise.
50
- * @returns <code>true</code> if the action is abortable and an action is ongoing, <code>false</code> otherwise.
51
- */
52
- export type AbortActionCallback<A> = (actionName: keyof A, promiseId?: string) => boolean;
53
- export type GetErrorMessage<F extends (...args: any[]) => any, P> = (e: any, args: Parameters<F>, props: P) => string;
54
- export interface AsynchActionBase<S, F extends (...args: any[]) => any, A, P> {
55
- /**
56
- * This action can be aborted. An abortSignal will be injected to the <code>promise</code> / <code>promiseGet</code>.
57
- */
58
- abortable?: boolean;
59
- /**
60
- * The success message to pass to the notifySuccess function passed as property to the StateDecorator.
61
- */
62
- successMessage?: string;
63
- /**
64
- * A function that provides the success message to pass to the notifySuccess function passed as property to the StateDecorator.
65
- */
66
- getSuccessMessage?: (result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P) => string;
67
- /**
68
- * The error message to pass to the notifyError function passed as property to the StateDecorator.
69
- */
70
- errorMessage?: string;
71
- /**
72
- * A function that provides the error message to pass to the notifyError function passed as property to the StateDecorator.
73
- */
74
- getErrorMessage?: GetErrorMessage<F, P>;
75
- /**
76
- * If set, called with the result of the promise to update the current state.
77
- */
78
- reducer?: (state: S, result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P) => S | null;
79
- /**
80
- * If set, called with the error of the promise to update the current state.
81
- */
82
- errorReducer?: (state: S, error: any, args: Parameters<F>, props: P) => S | null;
83
- /**
84
- * Whether reject the promise instead of handling it.
85
- */
86
- rejectPromiseOnError?: boolean;
87
- /**
88
- * Handle side effects when the request succeeded.
89
- * @param result The result of the request
90
- * @param newData The data after the reducer is applied
91
- * @param args The argument during the call of the request function
92
- * @param props The props passed to the state decorator
93
- * @param actions The actions available
94
- * @param notifyWarning If specified, a notify function to indicate that the action is a semi success (use successMessage / getSuccessMessage otherwise).
95
- */
96
- onDone?: (state: S, result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
97
- /**
98
- * Handle side effects when the request failed.
99
- * @param error The error of the request
100
- * @param args The argument during the call of the request function
101
- * @param props The props passed to the state decorator
102
- * @param actions The actions available
103
- * @param notifyWarning If specified, a notify function to indicate that the action is a semi failure (use errorMessage / getErrorMessage otherwise).
104
- */
105
- onFail?: (state: S, error: Error, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
106
- /**
107
- * Retrieve the state to set as current data before the promise is resolved.
108
- * If the there's no reducer, this data will be used after the promise is done.
109
- */
110
- preReducer?: (state: S, args: Parameters<F>, props: P) => S | null;
111
- /**
112
- * Retrieve the state to set as current data before the promise is resolved.
113
- * If the there's no reducer, this data will be used after the promise is done.
114
- */
115
- optimisticReducer?: (state: S, args: Parameters<F>, props: P) => S | null;
116
- /**
117
- * Policy to apply when a call to an asynchronous action is done but a previous call is still not resolved.
118
- */
119
- conflictPolicy?: ConflictPolicy;
120
- /**
121
- * Get an identifier for an action call. Used only when conflictPolicy is ConflictPolicy.PARALLEL.
122
- * This information will be available in loadingMap. loadingMap[actionName] will be an array of promise identifiers.
123
- */
124
- getPromiseId?: (...args: Parameters<F>) => string;
125
- /**
126
- * Number of retries in case of error (failed to fetch).
127
- * Do not use this if you are creating objects...
128
- * Default value is 0 (no retry).
129
- */
130
- retryCount?: number;
131
- /**
132
- * Seed of delay between each retry in milliseconds.
133
- * The applied delay is retryDelaySeed * retry count.
134
- * Default value is 1000 (1 second).
135
- */
136
- retryDelaySeed?: number;
137
- /**
138
- * Function to test if the error will trigger an action retry or will fail directly.
139
- */
140
- isTriggerRetryError?: (e: Error) => boolean;
141
- }
142
- export interface AsynchActionPromise<S, F extends (...args: any[]) => any, A, P> extends AsynchActionBase<S, F, A, P> {
143
- /**
144
- * The request, returns a promise
145
- */
146
- promise: PromiseProvider<S, F, A, P>;
147
- }
148
- export interface AsynchActionPromiseGet<S, F extends (...args: any[]) => any, A, P> extends AsynchActionBase<S, F, A, P> {
149
- /**
150
- * The request, returns a promise that is a GET request.
151
- * A shortcut to set:
152
- * - retryCount: 3
153
- * - conflictPolicy: ConflictPolicy.REUSE
154
- */
155
- promiseGet: PromiseProvider<S, F, A, P>;
156
- }
157
- export type AsynchAction<S, F extends (...args: any[]) => any, A, P> = AsynchActionPromise<S, F, A, P> | AsynchActionPromiseGet<S, F, A, P>;
158
- export type StateDecoratorAction<S, F extends (...args: any[]) => any, A, P> = AsynchAction<S, F, A, P> | SynchAction<S, F, P> | AdvancedSynchAction<S, F, A, P>;
159
- /**
160
- * S: The type of the state
161
- * A: The type of the actions to pass to the children (used to check keys only).
162
- */
163
- export type StateDecoratorActions<S, A extends DecoratedActions, P = {}> = {
164
- [Prop in keyof A]: StateDecoratorAction<S, A[Prop], A, P>;
165
- };
166
- type OnPropsChangeReducer<S, P> = (s: S, newProps: P, updatedIndices: number[]) => S;
167
- export type StateDecoratorOptions<S, A, P = {}> = {
168
- /**
169
- * The state decorator name. Use in debug traces to identify the useStateDecorator instance.
170
- */
171
- name?: string;
172
- /**
173
- * Show logs in the console in development mode.
174
- */
175
- logEnabled?: boolean;
176
- /**
177
- * List of action names that are marked as loading at initial time.
178
- * As a render is done before first actions can be trigerred, some actions can be marked as loading at
179
- * initial time.
180
- */
181
- initialActionsMarkedLoading?: (keyof A)[];
182
- /**
183
- * Get a list of values that will be use as reference values.
184
- * If they are different (shallow compare), onPropsChangeReducer then onPropsChange will be called.
185
- */
186
- getPropsRefValues?: (props: P) => any[];
187
- /**
188
- * Triggered when values of reference from props have changed. Allow to call actions after a prop change.
189
- */
190
- onPropsChange?: (s: S, newProps: any, actions: A, updatedIndices: number[]) => void;
191
- /**
192
- * Triggered when values of reference from props have changed. Allow to update state after a prop change.
193
- * <b>null</b> means no change.
194
- */
195
- onPropsChangeReducer?: OnPropsChangeReducer<S, P>;
196
- /**
197
- * The callback function called if an asynchronous function succeeded and a success messsage is defined.
198
- */
199
- notifySuccess?: NotifyFunc;
200
- /**
201
- * The callback function called if an asynchronous function fails and an error messsage is defined.
202
- */
203
- notifyError?: NotifyFunc;
204
- /**
205
- * The callback function injected in onDone and onFail of asynchronous functions to notify a semi success / failed request.
206
- */
207
- notifyWarning?: NotifyFunc;
208
- /**
209
- * Initial actions. They are executed outside of a side effect to trigger asynchronous actions.
210
- */
211
- onMount?: (actions: A, props: P, state: S) => void;
212
- };
213
- export {};
1
+ import { ConflictPolicy, DecoratedActions, NotifyFunc, PromiseResult } from './types';
2
+ export type PromiseProvider<S, F extends (...args: any[]) => any, A, P> = (args: Parameters<F>, state: S, props: P, actions: A, abortSignal: AbortSignal) => ReturnType<F> | null;
3
+ /**
4
+ * Simple form of a synchronous action.
5
+ */
6
+ export type SynchAction<S, F extends (...args: any[]) => any, P> = (state: S, args: Parameters<F>, props: P) => S | null;
7
+ /**
8
+ * Advanced synchronous action.
9
+ * Allows to set advanced properties to a synchronous action.
10
+ */
11
+ export type AdvancedSynchAction<S, F extends (...args: any[]) => any, A, P> = {
12
+ /**
13
+ * The action to execute.
14
+ */
15
+ action: (state: S, args: Parameters<F>, props: P) => S | null;
16
+ /**
17
+ * Debounces the side effects if this parameter is defined.
18
+ */
19
+ debounceSideEffectsTimeout?: number;
20
+ /**
21
+ * Debounces the action if this parameter is defined.
22
+ */
23
+ debounceTimeout?: number;
24
+ /**
25
+ * Action to call when the action is done. Used to trigger other actions (even asynchronous),
26
+ */
27
+ onActionDone?: (state: S, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
28
+ };
29
+ export type PromiseIdMap = {
30
+ [promiseId: string]: boolean;
31
+ };
32
+ export type InternalLoadingMap<A> = {
33
+ [name: string]: undefined | boolean | PromiseIdMap;
34
+ };
35
+ export type LoadingMap<A> = {
36
+ [P in keyof A]?: undefined | boolean;
37
+ };
38
+ export type LoadingMapParallelActions<A> = {
39
+ [P in keyof A]?: PromiseIdMap;
40
+ };
41
+ export type LoadingProps<A> = {
42
+ loading: boolean;
43
+ loadingMap: LoadingMap<A>;
44
+ loadingParallelMap: LoadingMapParallelActions<A>;
45
+ };
46
+ /**
47
+ * Try to abort an action, if the action is <code>abortable</code>.
48
+ * @param actionName The action name
49
+ * @param promiseId If the action conflict type is <code>ConflictType.PARALLEL</code>, the identifier of the promise.
50
+ * @returns <code>true</code> if the action is abortable and an action is ongoing, <code>false</code> otherwise.
51
+ */
52
+ export type AbortActionCallback<A> = (actionName: keyof A, promiseId?: string) => boolean;
53
+ export type GetErrorMessage<F extends (...args: any[]) => any, P> = (e: any, args: Parameters<F>, props: P) => string;
54
+ export interface AsynchActionBase<S, F extends (...args: any[]) => any, A, P> {
55
+ /**
56
+ * This action can be aborted. An abortSignal will be injected to the <code>promise</code> / <code>promiseGet</code>.
57
+ */
58
+ abortable?: boolean;
59
+ /**
60
+ * The success message to pass to the notifySuccess function passed as property to the StateDecorator.
61
+ */
62
+ successMessage?: string;
63
+ /**
64
+ * A function that provides the success message to pass to the notifySuccess function passed as property to the StateDecorator.
65
+ */
66
+ getSuccessMessage?: (result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P) => string;
67
+ /**
68
+ * The error message to pass to the notifyError function passed as property to the StateDecorator.
69
+ */
70
+ errorMessage?: string;
71
+ /**
72
+ * A function that provides the error message to pass to the notifyError function passed as property to the StateDecorator.
73
+ */
74
+ getErrorMessage?: GetErrorMessage<F, P>;
75
+ /**
76
+ * If set, called with the result of the promise to update the current state.
77
+ */
78
+ reducer?: (state: S, result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P) => S | null;
79
+ /**
80
+ * If set, called with the error of the promise to update the current state.
81
+ */
82
+ errorReducer?: (state: S, error: any, args: Parameters<F>, props: P) => S | null;
83
+ /**
84
+ * Whether reject the promise instead of handling it.
85
+ */
86
+ rejectPromiseOnError?: boolean;
87
+ /**
88
+ * Handle side effects when the request succeeded.
89
+ * @param result The result of the request
90
+ * @param newData The data after the reducer is applied
91
+ * @param args The argument during the call of the request function
92
+ * @param props The props passed to the state decorator
93
+ * @param actions The actions available
94
+ * @param notifyWarning If specified, a notify function to indicate that the action is a semi success (use successMessage / getSuccessMessage otherwise).
95
+ */
96
+ onDone?: (state: S, result: PromiseResult<ReturnType<F>>, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
97
+ /**
98
+ * Handle side effects when the request failed.
99
+ * @param error The error of the request
100
+ * @param args The argument during the call of the request function
101
+ * @param props The props passed to the state decorator
102
+ * @param actions The actions available
103
+ * @param notifyWarning If specified, a notify function to indicate that the action is a semi failure (use errorMessage / getErrorMessage otherwise).
104
+ */
105
+ onFail?: (state: S, error: Error, args: Parameters<F>, props: P, actions: A, notifyWarning: NotifyFunc) => void;
106
+ /**
107
+ * Retrieve the state to set as current data before the promise is resolved.
108
+ * If the there's no reducer, this data will be used after the promise is done.
109
+ */
110
+ preReducer?: (state: S, args: Parameters<F>, props: P) => S | null;
111
+ /**
112
+ * Retrieve the state to set as current data before the promise is resolved.
113
+ * If the there's no reducer, this data will be used after the promise is done.
114
+ */
115
+ optimisticReducer?: (state: S, args: Parameters<F>, props: P) => S | null;
116
+ /**
117
+ * Policy to apply when a call to an asynchronous action is done but a previous call is still not resolved.
118
+ */
119
+ conflictPolicy?: ConflictPolicy;
120
+ /**
121
+ * Get an identifier for an action call. Used only when conflictPolicy is ConflictPolicy.PARALLEL.
122
+ * This information will be available in loadingMap. loadingMap[actionName] will be an array of promise identifiers.
123
+ */
124
+ getPromiseId?: (...args: Parameters<F>) => string;
125
+ /**
126
+ * Number of retries in case of error (failed to fetch).
127
+ * Do not use this if you are creating objects...
128
+ * Default value is 0 (no retry).
129
+ */
130
+ retryCount?: number;
131
+ /**
132
+ * Seed of delay between each retry in milliseconds.
133
+ * The applied delay is retryDelaySeed * retry count.
134
+ * Default value is 1000 (1 second).
135
+ */
136
+ retryDelaySeed?: number;
137
+ /**
138
+ * Function to test if the error will trigger an action retry or will fail directly.
139
+ */
140
+ isTriggerRetryError?: (e: Error) => boolean;
141
+ }
142
+ export interface AsynchActionPromise<S, F extends (...args: any[]) => any, A, P> extends AsynchActionBase<S, F, A, P> {
143
+ /**
144
+ * The request, returns a promise
145
+ */
146
+ promise: PromiseProvider<S, F, A, P>;
147
+ }
148
+ export interface AsynchActionPromiseGet<S, F extends (...args: any[]) => any, A, P> extends AsynchActionBase<S, F, A, P> {
149
+ /**
150
+ * The request, returns a promise that is a GET request.
151
+ * A shortcut to set:
152
+ * - retryCount: 3
153
+ * - conflictPolicy: ConflictPolicy.REUSE
154
+ */
155
+ promiseGet: PromiseProvider<S, F, A, P>;
156
+ }
157
+ export type AsynchAction<S, F extends (...args: any[]) => any, A, P> = AsynchActionPromise<S, F, A, P> | AsynchActionPromiseGet<S, F, A, P>;
158
+ export type StateDecoratorAction<S, F extends (...args: any[]) => any, A, P> = AsynchAction<S, F, A, P> | SynchAction<S, F, P> | AdvancedSynchAction<S, F, A, P>;
159
+ /**
160
+ * S: The type of the state
161
+ * A: The type of the actions to pass to the children (used to check keys only).
162
+ */
163
+ export type StateDecoratorActions<S, A extends DecoratedActions, P = {}> = {
164
+ [Prop in keyof A]: StateDecoratorAction<S, A[Prop], A, P>;
165
+ };
166
+ type OnPropsChangeReducer<S, P> = (s: S, newProps: P, updatedIndices: number[]) => S;
167
+ export type StateDecoratorOptions<S, A, P = {}> = {
168
+ /**
169
+ * The state decorator name. Use in debug traces to identify the useStateDecorator instance.
170
+ */
171
+ name?: string;
172
+ /**
173
+ * Show logs in the console in development mode.
174
+ */
175
+ logEnabled?: boolean;
176
+ /**
177
+ * List of action names that are marked as loading at initial time.
178
+ * As a render is done before first actions can be trigerred, some actions can be marked as loading at
179
+ * initial time.
180
+ */
181
+ initialActionsMarkedLoading?: (keyof A)[];
182
+ /**
183
+ * Get a list of values that will be use as reference values.
184
+ * If they are different (shallow compare), onPropsChangeReducer then onPropsChange will be called.
185
+ */
186
+ getPropsRefValues?: (props: P) => any[];
187
+ /**
188
+ * Triggered when values of reference from props have changed. Allow to call actions after a prop change.
189
+ */
190
+ onPropsChange?: (s: S, newProps: any, actions: A, updatedIndices: number[]) => void;
191
+ /**
192
+ * Triggered when values of reference from props have changed. Allow to update state after a prop change.
193
+ * <b>null</b> means no change.
194
+ */
195
+ onPropsChangeReducer?: OnPropsChangeReducer<S, P>;
196
+ /**
197
+ * The callback function called if an asynchronous function succeeded and a success messsage is defined.
198
+ */
199
+ notifySuccess?: NotifyFunc;
200
+ /**
201
+ * The callback function called if an asynchronous function fails and an error messsage is defined.
202
+ */
203
+ notifyError?: NotifyFunc;
204
+ /**
205
+ * The callback function injected in onDone and onFail of asynchronous functions to notify a semi success / failed request.
206
+ */
207
+ notifyWarning?: NotifyFunc;
208
+ /**
209
+ * Initial actions. They are executed outside of a side effect to trigger asynchronous actions.
210
+ */
211
+ onMount?: (actions: A, props: P, state: S) => void;
212
+ };
213
+ export {};
package/es/v6.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { GlobalConfig, ParallelActionError, EffectError } from './impl';
2
- import type { DecoratedActions, StoreActions, AsyncAction, SyncAction, SimpleSyncAction, LoadingMap, ErrorMap, LoadingParallelMap, ErrorParallelMap, StoreOptions as StoreOptionsBase, AsyncActionPromise, InvocationContext, GetPromiseInvocationContext, EffectsInvocationContext, InvocationContextActions, WarningNotifyFunc, ErrorEffectsInvocationContext, OnMountInvocationContext, ContextBase, OnPropsChangeEffectsContext, ContextState, Middleware, AbortActionCallback, MiddlewareFactory, LoadingProps, ErrorProps, LoadingMapProps, StoreConfig } from './types';
3
- import { setGlobalConfig, IsLoadingFunc, StoreApi, StateListenerContext, ConflictPolicy } from './index';
4
- export type { StateListenerContext, StoreApi, DecoratedActions, StoreActions, LoadingMap, ErrorMap, LoadingParallelMap, ErrorParallelMap, AsyncActionPromise as AsynchActionPromise, InvocationContext, GetPromiseInvocationContext, EffectsInvocationContext, InvocationContextActions, WarningNotifyFunc, ErrorEffectsInvocationContext, OnMountInvocationContext, ContextBase, OnPropsChangeEffectsContext, SyncAction, AsyncAction, SimpleSyncAction, ContextState, GlobalConfig, Middleware, LoadingProps, AbortActionCallback, ErrorProps, LoadingMapProps, StoreConfig, IsLoadingFunc, };
5
- export { EffectError, ParallelActionError, ConflictPolicy, setGlobalConfig };
6
- export type StoreOptions<S, A, P = {}, DS = {}, FxRes = S> = StoreOptionsBase<S, A, P, DS, FxRes>;
7
- export type StoreAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S> = AsyncAction<S, F, A, P, DS, FxRes> | SimpleSyncAction<S, F, P, DS, FxRes> | SyncAction<S, F, A, P, DS, FxRes>;
8
- /**
9
- * Creates and manages a local store.
10
- * The component will be refreshed for every change in the store.
11
- * Store will NOT be destroyed when component is unmouted.
12
- *
13
- * @param getInitialState Function to compute initial state from props.
14
- * @param actionImpl Actions implementation.
15
- * @param props Owner component props to update state or react on prop changes
16
- * @param options The store options.
17
- * @param refreshOnUpdate Whether refresh the component if store state changes.
18
- * @returns The state, actions and isLoading function.
19
- */
20
- export default function useLocalStoreV6<S, A extends DecoratedActions, P, DS = {}>(getInitialState: (p: P) => S, actionImpl: StoreActions<S, A, P, DS>, props?: P, options?: StoreOptions<S, A, P, DS>, middlewares?: MiddlewareFactory<S, A, P>[], refreshOnUpdate?: boolean): StoreApi<S, A, P, DS>;
21
- export declare const useLocalStore: typeof useLocalStoreV6;
1
+ import { GlobalConfig, ParallelActionError, EffectError } from './impl';
2
+ import type { DecoratedActions, StoreActions, AsyncAction, SyncAction, SimpleSyncAction, LoadingMap, ErrorMap, LoadingParallelMap, ErrorParallelMap, StoreOptions as StoreOptionsBase, AsyncActionPromise, InvocationContext, GetPromiseInvocationContext, EffectsInvocationContext, InvocationContextActions, WarningNotifyFunc, ErrorEffectsInvocationContext, OnMountInvocationContext, ContextBase, OnPropsChangeEffectsContext, ContextState, Middleware, AbortActionCallback, MiddlewareFactory, LoadingProps, ErrorProps, LoadingMapProps, StoreConfig } from './types';
3
+ import { setGlobalConfig, IsLoadingFunc, StoreApi, StateListenerContext, ConflictPolicy } from './index';
4
+ export type { StateListenerContext, StoreApi, DecoratedActions, StoreActions, LoadingMap, ErrorMap, LoadingParallelMap, ErrorParallelMap, AsyncActionPromise as AsynchActionPromise, InvocationContext, GetPromiseInvocationContext, EffectsInvocationContext, InvocationContextActions, WarningNotifyFunc, ErrorEffectsInvocationContext, OnMountInvocationContext, ContextBase, OnPropsChangeEffectsContext, SyncAction, AsyncAction, SimpleSyncAction, ContextState, GlobalConfig, Middleware, LoadingProps, AbortActionCallback, ErrorProps, LoadingMapProps, StoreConfig, IsLoadingFunc, };
5
+ export { EffectError, ParallelActionError, ConflictPolicy, setGlobalConfig };
6
+ export type StoreOptions<S, A, P = {}, DS = {}, FxRes = S> = StoreOptionsBase<S, A, P, DS, FxRes>;
7
+ export type StoreAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = S> = AsyncAction<S, F, A, P, DS, FxRes> | SimpleSyncAction<S, F, P, DS, FxRes> | SyncAction<S, F, A, P, DS, FxRes>;
8
+ /**
9
+ * Creates and manages a local store.
10
+ * The component will be refreshed for every change in the store.
11
+ * Store will NOT be destroyed when component is unmouted.
12
+ *
13
+ * @param getInitialState Function to compute initial state from props.
14
+ * @param actionImpl Actions implementation.
15
+ * @param props Owner component props to update state or react on prop changes
16
+ * @param options The store options.
17
+ * @param refreshOnUpdate Whether refresh the component if store state changes.
18
+ * @returns The state, actions and isLoading function.
19
+ */
20
+ export default function useLocalStoreV6<S, A extends DecoratedActions, P, DS = {}>(getInitialState: (p: P) => S, actionImpl: StoreActions<S, A, P, DS>, props?: P, options?: StoreOptions<S, A, P, DS>, middlewares?: MiddlewareFactory<S, A, P>[], refreshOnUpdate?: boolean): StoreApi<S, A, P, DS>;
21
+ export declare const useLocalStore: typeof useLocalStoreV6;
package/es/v6.js CHANGED
@@ -1,2 +1,2 @@
1
- export{EffectError,ParallelActionError}from"./impl";import r from"./index";export{ConflictPolicy,setGlobalConfig}from"./index";var t=function(){return t=Object.assign||function(r){for(var t,o=1,e=arguments.length;o<e;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},t.apply(this,arguments)};function o(o,e,n,i,a,l){return void 0===l&&(l=!0),r(t(t({getInitialState:o,actions:e},i),{middlewares:a,fullStateEffects:!0}),n,l)}var e=o;export{o as default,e as useLocalStore};
1
+ export{EffectError,ParallelActionError}from"./impl";import r from"./index";export{ConflictPolicy,setGlobalConfig}from"./index";var t=function(){return t=Object.assign||function(r){for(var t,e=1,o=arguments.length;e<o;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},t.apply(this,arguments)};function e(e,o,n,i,a,f){return void 0===f&&(f=!0),r(t(t({getInitialState:e,actions:o},i),{middlewares:a,fullStateEffects:!0}),n,f)}"function"==typeof SuppressedError&&SuppressedError;var o=e;export{e as default,o as useLocalStore};
2
2
  //# sourceMappingURL=v6.js.map
package/es/v6.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v6.js","sources":["../../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this"],"mappings":"+HA+BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,CACV,EACMH,EAASa,MAAMC,KAAMP,UAChC"}
1
+ {"version":3,"file":"v6.js","sources":["../../node_modules/tslib/tslib.es6.mjs"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","SuppressedError"],"mappings":"+HA+BO,IAAIA,EAAW,WAQpB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,CACV,EACMH,EAASa,MAAMC,KAAMP,UAC9B,qIAmRkD,mBAApBQ,iBAAiCA"}
package/graph.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export default class Graph {
2
- private keys;
3
- private adj;
4
- constructor(keys: string[]);
5
- private isCyclicUtil;
6
- setEdges(sou: string, dest: string[]): void;
7
- isCyclic(): boolean;
8
- }
1
+ export default class Graph {
2
+ private keys;
3
+ private adj;
4
+ constructor(keys: string[]);
5
+ private isCyclicUtil;
6
+ setEdges(sou: string, dest: string[]): void;
7
+ isCyclic(): boolean;
8
+ }