state-decorator 7.0.0-beta.1 → 7.0.0-beta.11-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +271 -169
- package/es/helpers.d.ts +20 -2
- package/es/helpers.js +162 -1
- package/es/helpers.js.map +1 -1
- package/es/impl.d.ts +32 -20
- package/es/impl.js +974 -1
- package/es/impl.js.map +1 -1
- package/es/index.d.ts +31 -41
- package/es/index.js +1026 -1
- package/es/index.js.map +1 -1
- package/es/middlewares.d.ts +1 -1
- package/es/middlewares.js +519 -1
- package/es/middlewares.js.map +1 -1
- package/es/test.d.ts +10 -8
- package/es/test.js +339 -1
- package/es/test.js.map +1 -1
- package/es/types.d.ts +66 -50
- package/es/v5.js +301 -1
- package/es/v5.js.map +1 -1
- package/es/v5_test.js +392 -1
- package/es/v5_test.js.map +1 -1
- package/es/v5_types.d.ts +15 -15
- package/es/v6.d.ts +18 -0
- package/es/v6.js +110 -0
- package/es/v6.js.map +1 -0
- package/helpers.d.ts +20 -2
- package/helpers.js +174 -1
- package/helpers.js.map +1 -1
- package/impl.d.ts +32 -20
- package/impl.js +1007 -1
- package/impl.js.map +1 -1
- package/index.d.ts +31 -41
- package/index.js +1057 -1
- package/index.js.map +1 -1
- package/middlewares.d.ts +1 -1
- package/middlewares.js +526 -1
- package/middlewares.js.map +1 -1
- package/package.json +4 -2
- package/test.d.ts +10 -8
- package/test.js +348 -1
- package/test.js.map +1 -1
- package/types.d.ts +66 -50
- package/v5.js +322 -1
- package/v5.js.map +1 -1
- package/v5_test.js +416 -1
- package/v5_test.js.map +1 -1
- package/v5_types.d.ts +15 -15
- package/v6.d.ts +18 -0
- package/v6.js +135 -0
- package/v6.js.map +1 -0
- package/dist/impl.d.ts +0 -195
- package/dist/impl.js +0 -2
- package/dist/impl.js.map +0 -1
- package/dist/index.d.ts +0 -168
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/middlewares.d.ts +0 -26
- package/dist/middlewares.js +0 -2
- package/dist/middlewares.js.map +0 -1
- package/dist/shallow.d.ts +0 -15
- package/dist/test.d.ts +0 -134
- package/dist/test.js +0 -2
- package/dist/test.js.map +0 -1
- package/dist/types.d.ts +0 -352
- package/dist/v5.d.ts +0 -58
- package/dist/v5.js +0 -2
- package/dist/v5.js.map +0 -1
- package/dist/v5_test.d.ts +0 -70
- package/dist/v5_test.js +0 -2
- package/dist/v5_test.js.map +0 -1
- package/dist/v5_types.d.ts +0 -227
package/es/types.d.ts
CHANGED
|
@@ -12,34 +12,34 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type PromiseResult<Type> = Type extends Promise<infer X> ? X : null;
|
|
16
|
+
export type NotifyFunc = (msg: string) => void;
|
|
17
|
+
export type PromiseIdMap = {
|
|
18
18
|
[promiseId: string]: boolean;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type LoadingMap<A> = {
|
|
21
21
|
[pId in keyof A]?: boolean;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type LoadingParallelMap<A> = {
|
|
24
24
|
[P in keyof A]?: PromiseIdMap;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type InternalLoadingMap<A> = LoadingParallelMap<A>;
|
|
27
|
+
export type LoadingProps<A> = {
|
|
28
28
|
loading: boolean;
|
|
29
29
|
loadingMap: LoadingMap<A>;
|
|
30
30
|
loadingParallelMap: LoadingParallelMap<A>;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
33
|
-
export
|
|
32
|
+
export type LoadingMapProps<A> = Pick<LoadingProps<A>, 'loadingMap'>;
|
|
33
|
+
export type PromiseIdErrorMap = {
|
|
34
34
|
[promiseId: string]: Error;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type ErrorMap<A> = {
|
|
37
37
|
[pId in keyof A]?: Error;
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type ErrorParallelMap<A> = {
|
|
40
40
|
[P in keyof A]?: PromiseIdErrorMap;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type ErrorProps<A> = {
|
|
43
43
|
errorMap: ErrorMap<A>;
|
|
44
44
|
};
|
|
45
45
|
export interface DecoratedActions {
|
|
@@ -76,12 +76,12 @@ export declare enum ConflictPolicy {
|
|
|
76
76
|
*/
|
|
77
77
|
REUSE = "reuse"
|
|
78
78
|
}
|
|
79
|
-
export
|
|
79
|
+
export type PromiseProvider<S, DS, F extends (...args: any[]) => any, A, P> = (ctx: GetPromiseInvocationContext<S, DS, F, P, A>) => ReturnType<F> | null;
|
|
80
80
|
/**
|
|
81
81
|
* Simple form of a synchronous action.
|
|
82
82
|
*/
|
|
83
|
-
export
|
|
84
|
-
export
|
|
83
|
+
export type SimpleSyncAction<S, F extends (...args: any[]) => any, P, DS, FxRes = Partial<S>> = (ctx: InvocationContext<S, DS, F, P>) => FxRes | null;
|
|
84
|
+
export type SyncAction<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = {
|
|
85
85
|
/**
|
|
86
86
|
* Function that update the state when the action is called.
|
|
87
87
|
*/
|
|
@@ -105,71 +105,75 @@ export declare type SyncAction<S, F extends (...args: any[]) => any, A, P, DS, F
|
|
|
105
105
|
* @param promiseId If the action conflict type is <code>ConflictType.PARALLEL</code>, the identifier of the promise.
|
|
106
106
|
* @returns <code>true</code> if the action is abortable and an action is ongoing, <code>false</code> otherwise.
|
|
107
107
|
*/
|
|
108
|
-
export
|
|
109
|
-
export
|
|
110
|
-
export
|
|
108
|
+
export type AbortActionCallback<A> = (actionName: keyof A, promiseId?: string) => boolean;
|
|
109
|
+
export type GetErrorMessage<S, DS, F extends (...args: any[]) => any, P> = (ctx: ErrorMessageInvocationContext<S, DS, F, P>) => string | null;
|
|
110
|
+
export type ContextState<S> = {
|
|
111
111
|
state: S;
|
|
112
112
|
s: S;
|
|
113
113
|
};
|
|
114
|
-
export
|
|
114
|
+
export type ContextDerivedStateState<DS> = {
|
|
115
115
|
derived: DS;
|
|
116
116
|
ds: DS;
|
|
117
117
|
};
|
|
118
|
-
export
|
|
118
|
+
export type ContextBase<S, P> = ContextState<S> & {
|
|
119
119
|
props: P;
|
|
120
120
|
p: P;
|
|
121
121
|
};
|
|
122
|
-
export
|
|
123
|
-
export
|
|
122
|
+
export type ContextWithDerived<S, DS, P> = ContextBase<S, P> & ContextDerivedStateState<DS>;
|
|
123
|
+
export type InvocationContextActions<A> = {
|
|
124
124
|
actions: A;
|
|
125
125
|
a: A;
|
|
126
126
|
};
|
|
127
|
-
export
|
|
127
|
+
export type WarningNotifyFunc = {
|
|
128
128
|
notifyWarning?: NotifyFunc;
|
|
129
129
|
};
|
|
130
|
-
export
|
|
130
|
+
export type InvocationContext<S, DS, F extends (...args: any[]) => any, P> = ContextWithDerived<S, DS, P> & {
|
|
131
131
|
args: Parameters<F>;
|
|
132
132
|
promiseId: string;
|
|
133
133
|
};
|
|
134
|
-
export
|
|
134
|
+
export type EffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P> = InvocationContext<S, DS, F, P> & {
|
|
135
135
|
result: PromiseResult<ReturnType<F>>;
|
|
136
136
|
res: PromiseResult<ReturnType<F>>;
|
|
137
137
|
};
|
|
138
|
-
export
|
|
138
|
+
export type GetPromiseInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = InvocationContextActions<A> & InvocationContext<S, DS, F, P> & {
|
|
139
139
|
abortSignal: AbortSignal;
|
|
140
140
|
};
|
|
141
|
-
export
|
|
141
|
+
export type ErrorEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P> = InvocationContext<S, DS, F, P> & {
|
|
142
142
|
error: Error;
|
|
143
143
|
err: Error;
|
|
144
144
|
};
|
|
145
|
-
export
|
|
146
|
-
export
|
|
147
|
-
export
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
export
|
|
145
|
+
export type SuccessMessageInvocationContext<S, DS, F extends (...args: any[]) => any, P> = EffectsInvocationContext<S, DS, F, P>;
|
|
146
|
+
export type ErrorMessageInvocationContext<S, DS, F extends (...args: any[]) => any, P> = ErrorEffectsInvocationContext<S, DS, F, P>;
|
|
147
|
+
export type ClearErrorFunc<A> = (actionName: keyof A, promiseId?: string) => void;
|
|
148
|
+
export type ClearError<A> = {
|
|
149
|
+
clearError: ClearErrorFunc<A>;
|
|
150
|
+
};
|
|
151
|
+
export type SideEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = EffectsInvocationContext<S, DS, F, P> & InvocationContextActions<A> & WarningNotifyFunc & ClearError<A>;
|
|
152
|
+
export type ErrorSideEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = ErrorEffectsInvocationContext<S, DS, F, P> & InvocationContextActions<A> & WarningNotifyFunc;
|
|
153
|
+
export type OnMountInvocationContext<S, A, P> = ContextBase<S, P> & InvocationContextActions<A>;
|
|
154
|
+
export type AbortedActions<A> = Partial<Record<keyof A, string[]>>;
|
|
155
|
+
export type OnUnMountInvocationContext<S, A, P> = ContextBase<S, P> & {
|
|
152
156
|
abortedActions: AbortedActions<A>;
|
|
153
157
|
};
|
|
154
|
-
export
|
|
155
|
-
export
|
|
158
|
+
export type EffectsType = 'preEffects' | 'effects' | 'errorEffects' | 'optimisticEffects' | null;
|
|
159
|
+
export type MiddlewareActionContext<S, A, P> = {
|
|
156
160
|
name: keyof A;
|
|
157
161
|
type: EffectsType;
|
|
158
162
|
isAsync: boolean;
|
|
159
163
|
context: InvocationContext<S, any, any, P>;
|
|
160
164
|
};
|
|
161
|
-
export
|
|
165
|
+
export type MiddlewareStoreContext<S, A extends DecoratedActions, P> = {
|
|
162
166
|
actions: StoreActions<S, A, P, any, any>;
|
|
163
167
|
state: S;
|
|
164
168
|
setState: (s: S) => void;
|
|
165
169
|
options: StoreOptions<S, A, P, any>;
|
|
166
170
|
};
|
|
167
|
-
export
|
|
171
|
+
export type MiddlewareFactory<S, A extends DecoratedActions, P> = () => Middleware<S, A, P>;
|
|
168
172
|
/**
|
|
169
173
|
* A state change middleware.
|
|
170
174
|
* Allow to listen and change a state change on the fly.
|
|
171
175
|
*/
|
|
172
|
-
export
|
|
176
|
+
export type Middleware<S, A extends DecoratedActions, P> = {
|
|
173
177
|
/**
|
|
174
178
|
* Initializes the middleware. Called when the store is initializing.
|
|
175
179
|
*/
|
|
@@ -186,7 +190,7 @@ export declare type Middleware<S, A extends DecoratedActions, P> = {
|
|
|
186
190
|
*/
|
|
187
191
|
destroy: () => void;
|
|
188
192
|
};
|
|
189
|
-
export
|
|
193
|
+
export type AsyncActionBase<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = {
|
|
190
194
|
/**
|
|
191
195
|
* This action can be aborted. An abortSignal will be injected to the <code>promise</code> / <code>promiseGet</code>.
|
|
192
196
|
*/
|
|
@@ -272,13 +276,13 @@ export declare type AsyncActionBase<S, F extends (...args: any[]) => any, A, P,
|
|
|
272
276
|
*/
|
|
273
277
|
isTriggerRetryError?: (e: Error) => boolean;
|
|
274
278
|
};
|
|
275
|
-
export
|
|
279
|
+
export type AsyncActionPromise<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncActionBase<S, F, A, P, DS, FxRes> & {
|
|
276
280
|
/**
|
|
277
281
|
* The request, returns a promise
|
|
278
282
|
*/
|
|
279
283
|
getPromise: PromiseProvider<S, DS, F, A, P>;
|
|
280
284
|
};
|
|
281
|
-
export
|
|
285
|
+
export type AsyncActionPromiseGet<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = AsyncActionBase<S, F, A, P, DS, FxRes> & {
|
|
282
286
|
/**
|
|
283
287
|
* The request, returns a promise that is a GET request.
|
|
284
288
|
* A shortcut to set:
|
|
@@ -287,38 +291,39 @@ export declare type AsyncActionPromiseGet<S, F extends (...args: any[]) => any,
|
|
|
287
291
|
*/
|
|
288
292
|
getGetPromise: PromiseProvider<S, DS, F, A, P>;
|
|
289
293
|
};
|
|
290
|
-
export
|
|
291
|
-
export
|
|
294
|
+
export type AsyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncActionPromise<S, F, A, P, DS, FxRes> | AsyncActionPromiseGet<S, F, A, P, DS, FxRes>;
|
|
295
|
+
export type StoreAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncAction<S, F, A, P, DS, FxRes> | SimpleSyncAction<S, F, P, DS, FxRes> | SyncAction<S, F, A, P, DS, FxRes>;
|
|
292
296
|
/**
|
|
293
297
|
* S: The type of the state
|
|
294
298
|
* A: The type of the actions to pass to the children (used to check keys only).
|
|
295
299
|
*/
|
|
296
|
-
export
|
|
300
|
+
export type StoreActions<S, A extends DecoratedActions, P = {}, DS = {}, FxRes = Partial<S>> = {
|
|
297
301
|
[Prop in keyof A]: StoreAction<S, A[Prop], A, P, DS, FxRes>;
|
|
298
302
|
};
|
|
299
|
-
export
|
|
303
|
+
export type OnPropsChangeEffectsContext<S, DS, P> = ContextWithDerived<S, DS, P> & {
|
|
300
304
|
indices: number[];
|
|
301
305
|
index: number;
|
|
302
306
|
isInit: boolean;
|
|
307
|
+
getInitialState: (p: P) => S;
|
|
303
308
|
};
|
|
304
|
-
export
|
|
309
|
+
export type OnPropsChangeSideEffectsContext<S, P, A, DS = {}> = OnPropsChangeEffectsContext<S, DS, P> & {
|
|
305
310
|
actions: A;
|
|
306
311
|
a: A;
|
|
307
312
|
};
|
|
308
|
-
|
|
313
|
+
type DerivedStateOption<S, P, DS> = {
|
|
309
314
|
[k in keyof DS]: {
|
|
310
315
|
getDeps: (ctx: ContextBase<S, P>) => any[];
|
|
311
316
|
get: (ctx: ContextBase<S, P>) => DS[k];
|
|
312
317
|
};
|
|
313
318
|
};
|
|
314
|
-
export
|
|
319
|
+
export type OnPropsChangeOptions<S, DS, A, P> = {
|
|
315
320
|
onMount?: boolean;
|
|
316
321
|
onMountDeferred?: boolean;
|
|
317
322
|
getDeps: (p: P) => any[];
|
|
318
323
|
effects?: (ctx: OnPropsChangeEffectsContext<S, DS, P>) => Partial<S>;
|
|
319
324
|
sideEffects?: (ctx: OnPropsChangeSideEffectsContext<S, P, A>) => void;
|
|
320
325
|
};
|
|
321
|
-
export
|
|
326
|
+
export type StoreOptions<S, A, P = {}, DS = {}> = {
|
|
322
327
|
/**
|
|
323
328
|
* The state decorator name. Use in debug traces to identify the useStateDecorator instance.
|
|
324
329
|
*/
|
|
@@ -368,4 +373,15 @@ export declare type StoreOptions<S, A, P = {}, DS = {}> = {
|
|
|
368
373
|
*/
|
|
369
374
|
derivedState?: DerivedStateOption<S, P, DS>;
|
|
370
375
|
};
|
|
376
|
+
type StoreConfigBase<S, A extends DecoratedActions, P = {}, DS = {}> = {
|
|
377
|
+
actions: StoreActions<S, A, P, DS>;
|
|
378
|
+
middlewares?: MiddlewareFactory<S, A, P>[];
|
|
379
|
+
} & StoreOptions<S, A, P, DS>;
|
|
380
|
+
type StoreConfigObj<S, A extends DecoratedActions, P = {}, DS = {}> = StoreConfigBase<S, A, P, DS> & {
|
|
381
|
+
initialState: S;
|
|
382
|
+
};
|
|
383
|
+
type StoreConfigFunc<S, A extends DecoratedActions, P = {}, DS = {}> = StoreConfigBase<S, A, P, DS> & {
|
|
384
|
+
getInitialState: (p: P) => S;
|
|
385
|
+
};
|
|
386
|
+
export type StoreConfig<S, A extends DecoratedActions, P = {}, DS = {}> = StoreConfigObj<S, A, P, DS> | StoreConfigFunc<S, A, P, DS>;
|
|
371
387
|
export {};
|
package/es/v5.js
CHANGED
|
@@ -1,2 +1,302 @@
|
|
|
1
|
-
import{ConflictPolicy
|
|
1
|
+
import { ConflictPolicy, createStore } from './index';
|
|
2
|
+
export { ConflictPolicy, setGlobalConfig } from './index';
|
|
3
|
+
import { useReducer, useRef, useLayoutEffect, useEffect } from 'react';
|
|
4
|
+
import { logDetailedEffects } from './middlewares';
|
|
5
|
+
|
|
6
|
+
/*! *****************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
+
***************************************************************************** */
|
|
20
|
+
|
|
21
|
+
var __assign = function() {
|
|
22
|
+
__assign = Object.assign || function __assign(t) {
|
|
23
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
24
|
+
s = arguments[i];
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
return __assign.apply(this, arguments);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/*! *****************************************************************************
|
|
33
|
+
Copyright (c) GlobalSport SAS.
|
|
34
|
+
|
|
35
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
36
|
+
purpose with or without fee is hereby granted.
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
39
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
40
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
41
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
42
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
43
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
45
|
+
***************************************************************************** */
|
|
46
|
+
function isAsyncActionPromise(action) {
|
|
47
|
+
return !(action instanceof Function) && action.hasOwnProperty('promise');
|
|
48
|
+
}
|
|
49
|
+
function isAsyncActionPromiseGet(action) {
|
|
50
|
+
return !(action instanceof Function) && action.hasOwnProperty('promiseGet');
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Type guard function to test if an action is a asynchronous action.
|
|
54
|
+
*/
|
|
55
|
+
function isAsyncAction(action) {
|
|
56
|
+
return !(action instanceof Function) && (action.hasOwnProperty('promise') || action.hasOwnProperty('promiseGet'));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Type guard function to test if an action is a asynchronous action.
|
|
60
|
+
*/
|
|
61
|
+
function isAsyncPromiseGetAction(action) {
|
|
62
|
+
return !(action instanceof Function) && !(action.hasOwnProperty('promise') && action.hasOwnProperty('promiseGet'));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type guard function to test if an action is a synchronous action.
|
|
66
|
+
*/
|
|
67
|
+
function isSyncAction(action) {
|
|
68
|
+
return action instanceof Function;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Type guard function to test if an action is a synchronous action.
|
|
72
|
+
*/
|
|
73
|
+
function isAdvancedSyncAction(action) {
|
|
74
|
+
return !(action instanceof Function) && !action.hasOwnProperty('promise') && !action.hasOwnProperty('promiseGet');
|
|
75
|
+
}
|
|
76
|
+
function convertV5Actions(sourceActions) {
|
|
77
|
+
var actionNames = Object.keys(sourceActions);
|
|
78
|
+
return actionNames.reduce(function (acc, actionName) {
|
|
79
|
+
var sourceAction = sourceActions[actionName];
|
|
80
|
+
if (isSyncAction(sourceAction)) {
|
|
81
|
+
acc[actionName] = function (ctx) {
|
|
82
|
+
return sourceAction(ctx.s, ctx.args, ctx.p);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
else if (isAdvancedSyncAction(sourceAction)) {
|
|
86
|
+
var action = {
|
|
87
|
+
effects: function (ctx) {
|
|
88
|
+
return sourceAction.action(ctx.s, ctx.args, ctx.p);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
if (sourceAction.onActionDone) {
|
|
92
|
+
action.sideEffects = function (_a) {
|
|
93
|
+
var s = _a.s, p = _a.p, args = _a.args, a = _a.a, notifyWarning = _a.notifyWarning;
|
|
94
|
+
sourceAction.onActionDone(s, args, p, a, notifyWarning);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
acc[actionName] = action;
|
|
98
|
+
}
|
|
99
|
+
else if (isAsyncActionPromise(sourceAction) || isAsyncActionPromiseGet(sourceAction)) {
|
|
100
|
+
var asyncAction_1;
|
|
101
|
+
if (isAsyncActionPromiseGet(sourceAction)) {
|
|
102
|
+
asyncAction_1 = {
|
|
103
|
+
getPromise: function (_a) {
|
|
104
|
+
var s = _a.s, p = _a.p, a = _a.a, args = _a.args, abortSignal = _a.abortSignal;
|
|
105
|
+
return sourceAction.promiseGet(args, s, p, a, abortSignal);
|
|
106
|
+
},
|
|
107
|
+
retryCount: 3,
|
|
108
|
+
conflictPolicy: ConflictPolicy.REUSE,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
asyncAction_1 = {
|
|
113
|
+
getPromise: function (_a) {
|
|
114
|
+
var s = _a.s, p = _a.p, a = _a.a, args = _a.args, abortSignal = _a.abortSignal;
|
|
115
|
+
return sourceAction.promise(args, s, p, a, abortSignal);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
[
|
|
120
|
+
'abortable',
|
|
121
|
+
'conflictPolicy',
|
|
122
|
+
'getPromiseId',
|
|
123
|
+
'isTriggerRetryError',
|
|
124
|
+
'rejectPromiseOnError',
|
|
125
|
+
'retryCount',
|
|
126
|
+
'debounceTimeout',
|
|
127
|
+
'debounceSideEffectsTimeout',
|
|
128
|
+
'retryDelaySeed',
|
|
129
|
+
].forEach(function (prop) {
|
|
130
|
+
if (sourceAction[prop] != null) {
|
|
131
|
+
asyncAction_1[prop] = sourceAction[prop];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (sourceAction.successMessage) {
|
|
135
|
+
asyncAction_1.getSuccessMessage = function () { return sourceAction.successMessage; };
|
|
136
|
+
}
|
|
137
|
+
if (sourceAction.errorMessage) {
|
|
138
|
+
asyncAction_1.getSuccessMessage = function () { return sourceAction.errorMessage; };
|
|
139
|
+
}
|
|
140
|
+
if (sourceAction.getSuccessMessage) {
|
|
141
|
+
asyncAction_1.getSuccessMessage = function (_a) {
|
|
142
|
+
var res = _a.res, args = _a.args, p = _a.p;
|
|
143
|
+
return sourceAction.getSuccessMessage(res, args, p);
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (sourceAction.getErrorMessage) {
|
|
147
|
+
asyncAction_1.getErrorMessage = function (_a) {
|
|
148
|
+
var err = _a.err, args = _a.args, p = _a.p;
|
|
149
|
+
return sourceAction.getErrorMessage(err, args, p);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (sourceAction.preReducer) {
|
|
153
|
+
asyncAction_1.preEffects = function (_a) {
|
|
154
|
+
var s = _a.s, p = _a.p, args = _a.args;
|
|
155
|
+
return sourceAction.preReducer(s, args, p);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (sourceAction.optimisticReducer) {
|
|
159
|
+
asyncAction_1.optimisticEffects = function (_a) {
|
|
160
|
+
var s = _a.s, p = _a.p, args = _a.args;
|
|
161
|
+
return sourceAction.optimisticReducer(s, args, p);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (sourceAction.reducer) {
|
|
165
|
+
asyncAction_1.effects = function (_a) {
|
|
166
|
+
var s = _a.s, res = _a.res, p = _a.p, args = _a.args;
|
|
167
|
+
return sourceAction.reducer(s, res, args, p);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (sourceAction.errorReducer) {
|
|
171
|
+
asyncAction_1.errorEffects = function (_a) {
|
|
172
|
+
var s = _a.s, err = _a.err, p = _a.p, args = _a.args;
|
|
173
|
+
return sourceAction.errorReducer(s, err, args, p);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (sourceAction.onDone) {
|
|
177
|
+
asyncAction_1.sideEffects = function (_a) {
|
|
178
|
+
var s = _a.s, res = _a.res, p = _a.p, args = _a.args, a = _a.a, notifyWarning = _a.notifyWarning;
|
|
179
|
+
return sourceAction.onDone(s, res, args, p, a, notifyWarning);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (sourceAction.onFail) {
|
|
183
|
+
asyncAction_1.errorSideEffects = function (_a) {
|
|
184
|
+
var s = _a.s, err = _a.err, p = _a.p, args = _a.args, a = _a.a, notifyWarning = _a.notifyWarning;
|
|
185
|
+
return sourceAction.onFail(s, err, args, p, a, notifyWarning);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
acc[actionName] = asyncAction_1;
|
|
189
|
+
}
|
|
190
|
+
return acc;
|
|
191
|
+
}, {});
|
|
192
|
+
}
|
|
193
|
+
function convertV5Options(sourceOptions) {
|
|
194
|
+
var opts = {};
|
|
195
|
+
var keys = Object.keys(sourceOptions);
|
|
196
|
+
var doNotCopyProps = [
|
|
197
|
+
'onPropsChange',
|
|
198
|
+
'onPropsChangeReducer',
|
|
199
|
+
'getPropsRefValues',
|
|
200
|
+
'onMount',
|
|
201
|
+
'initialActionsMarkedLoading',
|
|
202
|
+
];
|
|
203
|
+
keys.forEach(function (prop) {
|
|
204
|
+
if (!doNotCopyProps.includes(prop)) {
|
|
205
|
+
opts[prop] = sourceOptions[prop];
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
if (sourceOptions.onMount) {
|
|
209
|
+
opts.onMount = function (_a) {
|
|
210
|
+
var s = _a.s, p = _a.p, a = _a.a;
|
|
211
|
+
return sourceOptions.onMount(a, p, s);
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (sourceOptions.getPropsRefValues) {
|
|
215
|
+
opts.onPropsChange = {
|
|
216
|
+
getDeps: sourceOptions.getPropsRefValues,
|
|
217
|
+
effects: function (_a) {
|
|
218
|
+
var s = _a.s, p = _a.p, indices = _a.indices;
|
|
219
|
+
return sourceOptions.onPropsChangeReducer ? sourceOptions.onPropsChangeReducer(s, p, indices) : null;
|
|
220
|
+
},
|
|
221
|
+
sideEffects: function (_a) {
|
|
222
|
+
var s = _a.s, p = _a.p, a = _a.a, indices = _a.indices;
|
|
223
|
+
return sourceOptions.onPropsChange == null ? null : sourceOptions.onPropsChange(s, p, a, indices);
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (sourceOptions.initialActionsMarkedLoading) {
|
|
228
|
+
opts.initialActionsMarkedLoading = sourceOptions.initialActionsMarkedLoading;
|
|
229
|
+
}
|
|
230
|
+
return opts;
|
|
231
|
+
}
|
|
232
|
+
function useStateDecorator(getInitialState, actions, props, options, middlewares) {
|
|
233
|
+
if (options === void 0) { options = {}; }
|
|
234
|
+
var _a = useReducer(function (s) { return (s > 100 ? 0 : s + 1); }, 0), forceRefresh = _a[1];
|
|
235
|
+
var actionsRef = useRef();
|
|
236
|
+
var optionsRef = useRef();
|
|
237
|
+
if (actionsRef.current == null) {
|
|
238
|
+
actionsRef.current = convertV5Actions(actions);
|
|
239
|
+
}
|
|
240
|
+
if (optionsRef.current == null) {
|
|
241
|
+
optionsRef.current = convertV5Options(options);
|
|
242
|
+
}
|
|
243
|
+
var storeRef = useRef();
|
|
244
|
+
if (storeRef.current == null) {
|
|
245
|
+
var middlewareFactories = middlewares;
|
|
246
|
+
if (options.logEnabled) {
|
|
247
|
+
middlewareFactories.push(logDetailedEffects());
|
|
248
|
+
}
|
|
249
|
+
storeRef.current = createStore(__assign(__assign({ getInitialState: getInitialState, actions: actionsRef.current }, optionsRef.current), { middlewares: middlewareFactories }));
|
|
250
|
+
}
|
|
251
|
+
storeRef.current.setProps(props);
|
|
252
|
+
useLayoutEffect(function () {
|
|
253
|
+
return storeRef.current.addStateListener(function () {
|
|
254
|
+
forceRefresh();
|
|
255
|
+
});
|
|
256
|
+
}, []);
|
|
257
|
+
var store = storeRef.current;
|
|
258
|
+
return {
|
|
259
|
+
state: store.state,
|
|
260
|
+
actions: store.actions,
|
|
261
|
+
loading: store.loading,
|
|
262
|
+
loadingMap: store.loadingMap,
|
|
263
|
+
loadingParallelMap: store.loadingParallelMap,
|
|
264
|
+
abortAction: store.abortAction,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Hook to execute a function when hook is mounted.
|
|
269
|
+
* @param onMount function to execute on the hook nount
|
|
270
|
+
*/
|
|
271
|
+
function useOnMount(onMount) {
|
|
272
|
+
useEffect(function () {
|
|
273
|
+
var removeListener = onMount();
|
|
274
|
+
return typeof removeListener === 'function' ? removeListener : undefined;
|
|
275
|
+
}, []);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Hook to execute a function when hook is unmounted.
|
|
279
|
+
* @param onUnMount function to execute on the hook nount
|
|
280
|
+
*/
|
|
281
|
+
function useOnUnmount(onUnmount, propList) {
|
|
282
|
+
if (propList === void 0) { propList = []; }
|
|
283
|
+
useEffect(function () {
|
|
284
|
+
return onUnmount;
|
|
285
|
+
}, propList);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Hook to execute a function when hook is unmounted.
|
|
289
|
+
* @param onUnMount function to execute on the hook nount
|
|
290
|
+
*/
|
|
291
|
+
function useOnUnload(onUnload) {
|
|
292
|
+
useEffect(function () {
|
|
293
|
+
document.addEventListener('beforeunload', onUnload);
|
|
294
|
+
return function () {
|
|
295
|
+
document.removeEventListener('beforeunload', onUnload);
|
|
296
|
+
};
|
|
297
|
+
}, []);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export default useStateDecorator;
|
|
301
|
+
export { isAdvancedSyncAction, isAsyncAction, isAsyncPromiseGetAction, isSyncAction, useOnMount, useOnUnload, useOnUnmount };
|
|
2
302
|
//# sourceMappingURL=v5.js.map
|
package/es/v5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v5.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"v5.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 __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 (_) 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 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\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: n === \"return\" } : 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"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|