(context, restMiddlewares)
| 23 | } |
| 24 | |
| 25 | const getNewState: Middleware = async (context, restMiddlewares) => { |
| 26 | const { |
| 27 | action, |
| 28 | modelName, |
| 29 | consumerActions, |
| 30 | params, |
| 31 | next, |
| 32 | Global, |
| 33 | type |
| 34 | } = context |
| 35 | if (type === 'u') { |
| 36 | // @ts-ignore |
| 37 | context.newState = action() |
| 38 | } else { |
| 39 | context.newState = |
| 40 | (await action(params, { |
| 41 | actions: consumerActions(Global.Actions[modelName], { modelName }), |
| 42 | state: Global.State[modelName], |
| 43 | ...(Global.Context['__global'] || {}), |
| 44 | ...(Global.Context[modelName] || {}) |
| 45 | })) || null |
| 46 | } |
| 47 | |
| 48 | return await next(restMiddlewares) |
| 49 | } |
| 50 | |
| 51 | const getNewStateWithCache = (maxTime: number = 5000): Middleware => async ( |
| 52 | context, |
nothing calls this directly
no test coverage detected
searching dependent graphs…