Comparing version 28.0.1-1626779281664 to 28.0.1-1626780376817
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { Overmind, createOvermindMock } from '../'; | ||
@@ -96,3 +95,3 @@ import { lazy, merge, namespaced } from './'; | ||
}); | ||
test('should keep context when lazy loading namespaces', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should keep context when lazy loading namespaces', async () => { | ||
const config = { | ||
@@ -111,9 +110,9 @@ state: { | ||
})); | ||
yield overmind.onInitialize(); | ||
yield overmind.actions.lazy.loadConfig('config'); | ||
await overmind.onInitialize(); | ||
await overmind.actions.lazy.loadConfig('config'); | ||
// @ts-ignore | ||
overmind.actions.config.changeFoo(); | ||
expect(overmind.state.config.foo).toEqual('bar2'); | ||
})); | ||
}); | ||
}); | ||
//# sourceMappingURL=config.test.js.map |
@@ -50,8 +50,19 @@ import isPlainObject from 'is-plain-obj'; | ||
state: copy(aggr.state, config.state || {}), | ||
effects: Object.assign(Object.assign({}, aggr.effects), config.effects), | ||
actions: Object.assign(Object.assign({}, aggr.actions), config.actions), | ||
effects: { | ||
...aggr.effects, | ||
...config.effects, | ||
}, | ||
actions: { | ||
...aggr.actions, | ||
...config.actions, | ||
}, | ||
}; | ||
}, Object.assign({ state: {}, actions: {}, effects: {} }, rootConfiguration)); | ||
}, { | ||
state: {}, | ||
actions: {}, | ||
effects: {}, | ||
...rootConfiguration, | ||
}); | ||
return reducedConfigurations; | ||
} | ||
//# sourceMappingURL=merge.js.map |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { PROXY_TREE } from 'proxy-state-tree'; | ||
@@ -16,3 +15,3 @@ import { EventType, Overmind, derived } from './'; | ||
}); | ||
test('should dynamically remove derived', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should dynamically remove derived', async () => { | ||
let dirtyCount = 0; | ||
@@ -54,5 +53,5 @@ const removeDerived = ({ state }) => { | ||
// The dirty event is async | ||
yield new Promise((resolve) => setTimeout(resolve, 0)); | ||
await new Promise((resolve) => setTimeout(resolve, 0)); | ||
expect(dirtyCount).toBe(1); | ||
})); | ||
}); | ||
test('should dynamically add derived', () => { | ||
@@ -59,0 +58,0 @@ const addDerived = ({ state }) => { |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { SERIALIZE } from './rehydrate'; | ||
@@ -54,3 +53,3 @@ export class Devtools { | ||
}; | ||
this.flushBuffer = () => __awaiter(this, void 0, void 0, function* () { | ||
this.flushBuffer = async () => { | ||
this.buffer.forEach((payload) => { | ||
@@ -60,3 +59,3 @@ this.sendMessage(payload); | ||
this.buffer.length = 0; | ||
}); | ||
}; | ||
this.name = | ||
@@ -104,3 +103,3 @@ typeof location !== 'undefined' && | ||
} | ||
catch (_a) { | ||
catch { | ||
unsafeClassNames.add(value.constructor.name); | ||
@@ -107,0 +106,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { EventType, Overmind, SERIALIZE, rehydrate } from './'; | ||
@@ -43,6 +42,6 @@ import { namespaced } from './config'; | ||
}; | ||
const asyncChangeFoo = (context) => __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.resolve(); | ||
const asyncChangeFoo = async (context) => { | ||
await Promise.resolve(); | ||
context.state.foo = 'bar2'; | ||
}); | ||
}; | ||
const changeValue = (_, value) => { | ||
@@ -59,4 +58,4 @@ value.isAwesome = !value.isAwesome; | ||
}; | ||
const asyncChangeOptionalFoo = (context, newFoo) => __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.resolve(); | ||
const asyncChangeOptionalFoo = async (context, newFoo) => { | ||
await Promise.resolve(); | ||
if (newFoo !== undefined) { | ||
@@ -68,3 +67,3 @@ context.state.foo = newFoo; | ||
} | ||
}); | ||
}; | ||
const changeFormValue = (_, payload) => { | ||
@@ -115,3 +114,3 @@ const { form, key, value } = payload; | ||
}); | ||
test('should instantiate app with onInitialize', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should instantiate app with onInitialize', async () => { | ||
expect.assertions(2); | ||
@@ -131,5 +130,5 @@ let value; | ||
}); | ||
yield app.initialized; | ||
await app.initialized; | ||
expect(value).toBe(app); | ||
})); | ||
}); | ||
test('should be able to type actions', () => { | ||
@@ -168,3 +167,3 @@ expect.assertions(2); | ||
}); | ||
test('should track action start and end', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should track action start and end', async () => { | ||
expect.assertions(2); | ||
@@ -176,3 +175,3 @@ const app = new Overmind({ | ||
}); | ||
yield app.initialized; | ||
await app.initialized; | ||
app.eventHub.once(EventType.ACTION_START, (data) => { | ||
@@ -203,4 +202,4 @@ expect(toJSON(data)).toEqual({ | ||
app.actions.doThis(); | ||
})); | ||
test('should track operator start and end', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('should track operator start and end', async () => { | ||
expect.assertions(2); | ||
@@ -212,3 +211,3 @@ const app = new Overmind({ | ||
}); | ||
yield app.initialized; | ||
await app.initialized; | ||
app.eventHub.once(EventType.OPERATOR_START, (data) => { | ||
@@ -240,7 +239,7 @@ expect(toJSON(data)).toEqual({ | ||
app.actions.doThis(); | ||
})); | ||
test('should track mutations', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('should track mutations', async () => { | ||
expect.assertions(1); | ||
const app = createDefaultOvermind(); | ||
yield app.initialized; | ||
await app.initialized; | ||
app.eventHub.once(EventType.MUTATIONS, (data) => { | ||
@@ -268,7 +267,7 @@ expect(toJSON(data)).toEqual({ | ||
app.actions.changeFoo(); | ||
})); | ||
test('should track async mutations', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('should track async mutations', async () => { | ||
expect.assertions(1); | ||
const app = createDefaultOvermind(); | ||
yield app.initialized; | ||
await app.initialized; | ||
app.eventHub.on(EventType.MUTATIONS, (data) => { | ||
@@ -295,8 +294,8 @@ expect(toJSON(data)).toEqual({ | ||
}); | ||
yield app.actions.waitAndChangeFoo(); | ||
})); | ||
test('should track async mutations with async await', () => __awaiter(void 0, void 0, void 0, function* () { | ||
await app.actions.waitAndChangeFoo(); | ||
}); | ||
test('should track async mutations with async await', async () => { | ||
expect.assertions(1); | ||
const app = createDefaultOvermind(); | ||
yield app.initialized; | ||
await app.initialized; | ||
app.eventHub.on(EventType.MUTATIONS, (data) => { | ||
@@ -323,4 +322,4 @@ expect(toJSON(data)).toEqual({ | ||
}); | ||
yield app.actions.asyncChangeFoo(); | ||
})); | ||
await app.actions.asyncChangeFoo(); | ||
}); | ||
test('should instantiate app with modules', () => { | ||
@@ -424,7 +423,7 @@ const foo = { | ||
}); | ||
test('should allow actions with optional parameter', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should allow actions with optional parameter', async () => { | ||
const app = createDefaultOvermind(); | ||
app.actions.changeOptionalFoo(); | ||
expect(app.state.foo).toBe('default-foo'); | ||
yield app.actions.asyncChangeOptionalFoo(); | ||
await app.actions.asyncChangeOptionalFoo(); | ||
expect(app.state.foo).toBe('async-default-foo'); | ||
@@ -435,6 +434,6 @@ const newFoo = 'new-foo'; | ||
const newAsyncFoo = 'new-async-foo'; | ||
yield app.actions.asyncChangeOptionalFoo(newAsyncFoo); | ||
await app.actions.asyncChangeOptionalFoo(newAsyncFoo); | ||
expect(app.state.foo).toBe(newAsyncFoo); | ||
})); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { createOvermindMock } from './'; | ||
@@ -65,3 +64,3 @@ describe('Mock', () => { | ||
}); | ||
test('should preserve getters', (done) => __awaiter(void 0, void 0, void 0, function* () { | ||
test('should preserve getters', async (done) => { | ||
expect.assertions(1); | ||
@@ -80,7 +79,7 @@ const state = { | ||
const mock = createOvermindMock(config); | ||
yield mock.actions.updateValue(); | ||
await mock.actions.updateValue(); | ||
expect(mock.state.valuePlusTwo).toEqual(17); | ||
done(); | ||
})); | ||
test('should allow setting initial state', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('should allow setting initial state', async () => { | ||
expect.assertions(1); | ||
@@ -95,4 +94,4 @@ const state = { | ||
expect(mock.state.value).toBe(1); | ||
})); | ||
test('should allow setting initial and mock effect', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('should allow setting initial and mock effect', async () => { | ||
expect.assertions(2); | ||
@@ -124,4 +123,4 @@ const state = { | ||
expect(mock.actions.runFoo()).toBe('bar2'); | ||
})); | ||
}); | ||
}); | ||
//# sourceMappingURL=mock.test.js.map |
@@ -24,4 +24,7 @@ import { EventType } from './internalTypes'; | ||
context.execution.isRunning = true; | ||
context.execution.emit(EventType.OPERATOR_START, Object.assign(Object.assign({}, context.execution), { name, | ||
type })); | ||
context.execution.emit(EventType.OPERATOR_START, { | ||
...context.execution, | ||
name, | ||
type, | ||
}); | ||
} | ||
@@ -31,3 +34,6 @@ export function operatorStopped(context, value, details = {}) { | ||
if (value instanceof Promise) { | ||
context.execution.emit(EventType.OPERATOR_ASYNC, Object.assign(Object.assign({}, context.execution), { isAsync: true })); | ||
context.execution.emit(EventType.OPERATOR_ASYNC, { | ||
...context.execution, | ||
isAsync: true, | ||
}); | ||
} | ||
@@ -45,3 +51,8 @@ return; | ||
context.execution.isRunning = false; | ||
context.execution.emit(EventType.OPERATOR_END, Object.assign(Object.assign(Object.assign({}, context.execution), { result: promiseValue, isAsync: true }), evaluatedDetails)); | ||
context.execution.emit(EventType.OPERATOR_END, { | ||
...context.execution, | ||
result: promiseValue, | ||
isAsync: true, | ||
...evaluatedDetails, | ||
}); | ||
}) | ||
@@ -54,3 +65,8 @@ .catch(() => { | ||
context.execution.isRunning = false; | ||
context.execution.emit(EventType.OPERATOR_END, Object.assign(Object.assign(Object.assign({}, context.execution), { result: value, isAsync: false }), evaluatedDetails)); | ||
context.execution.emit(EventType.OPERATOR_END, { | ||
...context.execution, | ||
result: value, | ||
isAsync: false, | ||
...evaluatedDetails, | ||
}); | ||
} | ||
@@ -60,13 +76,27 @@ } | ||
if (process.env.NODE_ENV === 'production') { | ||
return Object.assign(Object.assign({}, context), { value }); | ||
return { | ||
...context, | ||
value, | ||
}; | ||
} | ||
const newExecution = Object.assign(Object.assign({}, context.execution), { operatorId: context.execution.getNextOperatorId(), path: path || context.execution.path }); | ||
const newExecution = { | ||
...context.execution, | ||
operatorId: context.execution.getNextOperatorId(), | ||
path: path || context.execution.path, | ||
}; | ||
const mutationTrees = []; | ||
return Object.assign(Object.assign({}, context), { actions: createActionsProxy(context.actions[ORIGINAL_ACTIONS] || context.actions, (action) => { | ||
return { | ||
...context, | ||
actions: createActionsProxy(context.actions[ORIGINAL_ACTIONS] || context.actions, (action) => { | ||
return (value) => action(value, newExecution.isRunning ? newExecution : null); | ||
}), value, execution: newExecution, effects: context.execution.trackEffects(newExecution), flush: context.parentExecution | ||
}), | ||
value, | ||
execution: newExecution, | ||
effects: context.execution.trackEffects(newExecution), | ||
flush: context.parentExecution | ||
? context.parentExecution.flush | ||
: (isAsync) => { | ||
return this.proxyStateTree.flush(mutationTrees, isAsync); | ||
}, getMutationTree: context.parentExecution | ||
}, | ||
getMutationTree: context.parentExecution | ||
? context.parentExecution.getMutationTree | ||
@@ -82,3 +112,4 @@ : () => { | ||
return mutationTree; | ||
} }); | ||
}, | ||
}; | ||
} | ||
@@ -90,3 +121,9 @@ export function createNextPath(next) { | ||
return (err, context) => { | ||
const newContext = Object.assign(Object.assign({}, context), { execution: Object.assign(Object.assign({}, context.execution), { path: context.execution.path.slice(0, context.execution.path.length - 1) }) }); | ||
const newContext = { | ||
...context, | ||
execution: { | ||
...context.execution, | ||
path: context.execution.path.slice(0, context.execution.path.length - 1), | ||
}, | ||
}; | ||
if (err) | ||
@@ -158,3 +195,6 @@ next(err, newContext); | ||
if (!nextIsCalled) { | ||
context.execution.emit(EventType.OPERATOR_ASYNC, Object.assign(Object.assign({}, context.execution), { isAsync: true })); | ||
context.execution.emit(EventType.OPERATOR_ASYNC, { | ||
...context.execution, | ||
isAsync: true, | ||
}); | ||
} | ||
@@ -171,3 +211,6 @@ }; | ||
mutationTree.onMutation((mutation) => { | ||
context.execution.emit(EventType.MUTATIONS, Object.assign(Object.assign({}, context.execution), { mutations: [mutation] })); | ||
context.execution.emit(EventType.MUTATIONS, { | ||
...context.execution, | ||
mutations: [mutation], | ||
}); | ||
}); | ||
@@ -223,3 +266,7 @@ } | ||
type: 'flush', | ||
data: Object.assign(Object.assign(Object.assign({}, context.execution), flushData), { mutations: flushData.mutations }), | ||
data: { | ||
...context.execution, | ||
...flushData, | ||
mutations: flushData.mutations, | ||
}, | ||
}); | ||
@@ -239,3 +286,6 @@ } | ||
if (!nextIsCalled) { | ||
context.execution.emit(EventType.OPERATOR_ASYNC, Object.assign(Object.assign({}, context.execution), { isAsync: true })); | ||
context.execution.emit(EventType.OPERATOR_ASYNC, { | ||
...context.execution, | ||
isAsync: true, | ||
}); | ||
} | ||
@@ -242,0 +292,0 @@ }; |
@@ -42,3 +42,6 @@ import { action, createContext, createMutationOperator, createNextPath, createOperator, operatorStarted, operatorStopped, } from './operator'; | ||
: (err, finalContext, finalNext, finalFinal) => { | ||
next(err, Object.assign(Object.assign({}, finalContext), { value: context.value }), finalNext, finalFinal); | ||
next(err, { | ||
...finalContext, | ||
value: context.value, | ||
}, finalNext, finalFinal); | ||
}; | ||
@@ -45,0 +48,0 @@ try { |
@@ -1,5 +0,4 @@ | ||
import { __awaiter } from "tslib"; | ||
import { Overmind, pipe, branch, filter, fork, when, wait, debounce, parallel, catchError, tryCatch, throttle, waitUntil, } from './'; | ||
describe('OPERATORS', () => { | ||
test('branch - passes input as output', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('branch - passes input as output', async () => { | ||
expect.assertions(1); | ||
@@ -19,6 +18,6 @@ const state = { | ||
const overmind = new Overmind(config); | ||
yield overmind.actions.test('foo'); | ||
await overmind.actions.test('foo'); | ||
expect(overmind.state.foo).toBe('foo'); | ||
})); | ||
test('action - return value', () => __awaiter(void 0, void 0, void 0, function* () { | ||
}); | ||
test('action - return value', async () => { | ||
expect.assertions(1); | ||
@@ -38,5 +37,5 @@ const state = { | ||
const overmind = new Overmind(config); | ||
yield overmind.actions.test('foo'); | ||
await overmind.actions.test('foo'); | ||
expect(overmind.state.foo).toBe('FOO'); | ||
})); | ||
}); | ||
test('action - return value async', () => { | ||
@@ -60,3 +59,3 @@ expect.assertions(1); | ||
}); | ||
test('parallel', () => __awaiter(void 0, void 0, void 0, function* () { | ||
test('parallel', async () => { | ||
expect.assertions(1); | ||
@@ -76,5 +75,5 @@ const operatorA = () => { | ||
const overmind = new Overmind(config); | ||
const result = yield overmind.actions.test(); | ||
const result = await overmind.actions.test(); | ||
expect(result).toEqual(['A', 'B']); | ||
})); | ||
}); | ||
test('filter - truthy', () => { | ||
@@ -81,0 +80,0 @@ expect.assertions(1); |
@@ -174,3 +174,6 @@ import { EventEmitter } from 'betsy'; | ||
type: 'flush', | ||
data: Object.assign(Object.assign({}, execution), flushData), | ||
data: { | ||
...execution, | ||
...flushData, | ||
}, | ||
}); | ||
@@ -187,3 +190,6 @@ } | ||
type: 'flush', | ||
data: Object.assign(Object.assign({}, execution), flushData), | ||
data: { | ||
...execution, | ||
...flushData, | ||
}, | ||
}); | ||
@@ -361,9 +367,18 @@ } | ||
const execution = this.createExecution(name, action, boundExecution); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_START, Object.assign(Object.assign({}, execution), { value })); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_START, { | ||
...execution, | ||
value, | ||
}); | ||
if (action[utils.IS_OPERATOR]) { | ||
return new Promise((resolve, reject) => { | ||
action(null, Object.assign(Object.assign({}, this.createContext(execution, this.proxyStateTreeInstance)), { value }), (err, finalContext) => { | ||
action(null, { | ||
...this.createContext(execution, this.proxyStateTreeInstance), | ||
value, | ||
}, (err, finalContext) => { | ||
execution.isRunning = false; | ||
finalContext && | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, Object.assign(Object.assign({}, finalContext.execution), { operatorId: finalContext.execution.operatorId - 1 })); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, { | ||
...finalContext.execution, | ||
operatorId: finalContext.execution.operatorId - 1, | ||
}); | ||
if (err) | ||
@@ -388,4 +403,11 @@ reject(err); | ||
else { | ||
const execution = Object.assign(Object.assign({}, this.createExecution(name, action, boundExecution)), { operatorId: 0, type: 'action' }); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_START, Object.assign(Object.assign({}, execution), { value })); | ||
const execution = { | ||
...this.createExecution(name, action, boundExecution), | ||
operatorId: 0, | ||
type: 'action', | ||
}; | ||
this.eventHub.emit(internalTypes.EventType.ACTION_START, { | ||
...execution, | ||
value, | ||
}); | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_START, execution); | ||
@@ -397,3 +419,6 @@ const mutationTree = execution.getMutationTree(); | ||
mutationTree.onMutation((mutation) => { | ||
this.eventHub.emit(internalTypes.EventType.MUTATIONS, Object.assign(Object.assign({}, execution), { mutations: [mutation] })); | ||
this.eventHub.emit(internalTypes.EventType.MUTATIONS, { | ||
...execution, | ||
mutations: [mutation], | ||
}); | ||
}); | ||
@@ -418,3 +443,7 @@ const scopedValue = this.scopeValue(value, mutationTree); | ||
type: 'flush', | ||
data: Object.assign(Object.assign(Object.assign({}, execution), flushData), { mutations: flushData.mutations }), | ||
data: { | ||
...execution, | ||
...flushData, | ||
mutations: flushData.mutations, | ||
}, | ||
}); | ||
@@ -434,3 +463,7 @@ } | ||
} | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, Object.assign(Object.assign({}, execution), { isAsync: true, result: undefined })); | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, { | ||
...execution, | ||
isAsync: true, | ||
result: undefined, | ||
}); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, execution); | ||
@@ -444,3 +477,8 @@ return promiseResult; | ||
} | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, Object.assign(Object.assign({}, execution), { isAsync: true, result: undefined, error: error.message })); | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, { | ||
...execution, | ||
isAsync: true, | ||
result: undefined, | ||
error: error.message, | ||
}); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, execution); | ||
@@ -455,3 +493,7 @@ throw error; | ||
} | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, Object.assign(Object.assign({}, execution), { isAsync: false, result: undefined })); | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, { | ||
...execution, | ||
isAsync: false, | ||
result: undefined, | ||
}); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, execution); | ||
@@ -462,3 +504,8 @@ } | ||
catch (err) { | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, Object.assign(Object.assign({}, execution), { isAsync: false, result: undefined, error: err.message })); | ||
this.eventHub.emit(internalTypes.EventType.OPERATOR_END, { | ||
...execution, | ||
isAsync: false, | ||
result: undefined, | ||
error: err.message, | ||
}); | ||
this.eventHub.emit(internalTypes.EventType.ACTION_END, execution); | ||
@@ -483,3 +530,9 @@ throw err; | ||
else { | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, isPending: true, error: false })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
isPending: true, | ||
error: false, | ||
}); | ||
result = effect.func.apply(this, effect.args); | ||
@@ -489,18 +542,50 @@ } | ||
catch (error) { | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, isPending: false, error: error.message })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
isPending: false, | ||
error: error.message, | ||
}); | ||
throw error; | ||
} | ||
if (utils.isPromise(result)) { | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, isPending: true, error: false })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
isPending: true, | ||
error: false, | ||
}); | ||
return result | ||
.then((promisedResult) => { | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, result: promisedResult, isPending: false, error: false })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
result: promisedResult, | ||
isPending: false, | ||
error: false, | ||
}); | ||
return promisedResult; | ||
}) | ||
.catch((error) => { | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, isPending: false, error: error && error.message })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
isPending: false, | ||
error: error && error.message, | ||
}); | ||
throw error; | ||
}); | ||
} | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, Object.assign(Object.assign(Object.assign({}, execution), effect), { args: effect.args, result: result, isPending: false, error: false })); | ||
this.eventHub.emit(internalTypes.EventType.EFFECT, { | ||
...execution, | ||
...effect, | ||
args: effect.args, | ||
result: result, | ||
isPending: false, | ||
error: false, | ||
}); | ||
return result; | ||
@@ -507,0 +592,0 @@ }); |
@@ -17,3 +17,3 @@ import isPlainObject from 'is-plain-obj'; | ||
} | ||
catch (_a) { | ||
catch { | ||
console.warn('Overmind was unable to determine the NODE_ENV, which means it will run in DEVELOPMENT mode. If this is a production app, please configure your build tool to define NODE_ENV'); | ||
@@ -20,0 +20,0 @@ env = 'development'; |
{ | ||
"name": "overmind", | ||
"version": "28.0.1-1626779281664", | ||
"version": "28.0.1-1626780376817", | ||
"description": "Frictionless state management", | ||
@@ -14,3 +14,3 @@ "author": "Christian Alfoni <christianalfoni@gmail.com>", | ||
"build:lib": "tsc --outDir lib --module commonjs", | ||
"build:es": "tsc --outDir es --module es2015", | ||
"build:es": "tsc --outDir es --module ES2020 --target ES2020", | ||
"build:dist": "webpack --config webpack.config.js", | ||
@@ -39,5 +39,5 @@ "clean": "rimraf es lib coverage", | ||
"is-plain-obj": "^1.1.0", | ||
"betsy": "1.0.2-1626779281664", | ||
"betsy": "1.0.2-1626780376817", | ||
"tslib": "^2.3.0", | ||
"proxy-state-tree": "6.3.0-1626779281664" | ||
"proxy-state-tree": "6.3.0-1626780376817" | ||
}, | ||
@@ -44,0 +44,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
937869
9319
+ Addedbetsy@1.0.2-1626780376817(transitive)
+ Addedproxy-state-tree@6.3.0-1626780376817(transitive)
- Removedbetsy@1.0.2-1626779281664(transitive)
- Removedproxy-state-tree@6.3.0-1626779281664(transitive)
Updatedbetsy@1.0.2-1626780376817