Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

overmind

Package Overview
Dependencies
Maintainers
4
Versions
886
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overmind - npm Package Compare versions

Comparing version 28.0.1 to 28.0.2-1663316392640

9

es/config/config.test.js

@@ -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 }) => {

@@ -0,1 +1,2 @@

import { LogLevel } from './internalTypes';
export declare type Message = {

@@ -11,2 +12,3 @@ type: string;

export declare class Devtools {
private logLevel;
private safeClassNames;

@@ -23,3 +25,3 @@ private unsafeClassNames;

private name;
constructor(name: string);
constructor(name: string, logLevel?: LogLevel);
connect: (host: string, onMessage: (message: Message) => void) => void;

@@ -26,0 +28,0 @@ private reconnect;

@@ -1,5 +0,5 @@

import { __awaiter } from "tslib";
import { SERIALIZE } from './rehydrate';
export class Devtools {
constructor(name) {
constructor(name, logLevel = 'error') {
this.logLevel = logLevel;
this.safeClassNames = new Set();

@@ -29,3 +29,3 @@ this.unsafeClassNames = new Set();

this.ws.onerror = () => {
console.error(`OVERMIND DEVTOOLS: Not able to connect. You are trying to connect to "${host}", but there was no devtool there. Try the following:
console[this.logLevel](`OVERMIND DEVTOOLS: Not able to connect. You are trying to connect to "${host}", but there was no devtool there. Try the following:

@@ -55,3 +55,3 @@ - Make sure you are running the latest version of the devtools, using "npx overmind-devtools@latest" or install latest extension for VSCode

};
this.flushBuffer = () => __awaiter(this, void 0, void 0, function* () {
this.flushBuffer = async () => {
this.buffer.forEach((payload) => {

@@ -61,3 +61,3 @@ this.sendMessage(payload);

this.buffer.length = 0;
});
};
this.name =

@@ -105,3 +105,3 @@ typeof location !== 'undefined' &&

}
catch (_a) {
catch {
unsafeClassNames.add(value.constructor.name);

@@ -108,0 +108,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

@@ -9,2 +9,3 @@ import { IFlushCallback, IMutation, IMutationTree, ITrackStateTree } from 'proxy-state-tree';

}>;
export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
export declare type Options = {

@@ -18,2 +19,3 @@ delimiter?: string;

strict?: boolean;
devtoolsLogLevel?: LogLevel;
};

@@ -20,0 +22,0 @@ export declare type DefaultMode = {

@@ -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);

@@ -5,3 +5,3 @@ import { EventEmitter } from 'betsy';

import * as internalTypes from './internalTypes';
import { IConfiguration, IReaction, IContext } from './types';
import { IConfiguration, IContext, IReaction } from './types';
export declare class Overmind<ThisConfig extends IConfiguration> implements IConfiguration {

@@ -8,0 +8,0 @@ private proxyStateTreeInstance;

@@ -128,3 +128,3 @@ import { EventEmitter } from 'betsy';

: document.title || 'NoName';
this.initializeDevtools(host, name, eventHub, proxyStateTreeInstance.sourceState, configuration.actions);
this.initializeDevtools(host, name, eventHub, proxyStateTreeInstance.sourceState, configuration.actions, options.devtoolsLogLevel);
}

@@ -175,3 +175,6 @@ else if (options.devtools !== false) {

type: 'flush',
data: Object.assign(Object.assign({}, execution), flushData),
data: {
...execution,
...flushData,
},
});

@@ -188,3 +191,6 @@ }

type: 'flush',
data: Object.assign(Object.assign({}, execution), flushData),
data: {
...execution,
...flushData,
},
});

@@ -362,9 +368,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)

@@ -389,4 +404,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);

@@ -398,3 +420,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],
});
});

@@ -419,3 +444,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,
},
});

@@ -435,3 +464,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);

@@ -445,3 +478,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);

@@ -456,3 +494,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);

@@ -463,3 +505,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);

@@ -484,3 +531,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);

@@ -490,25 +543,57 @@ }

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;
});
}
initializeDevtools(host, name, eventHub, initialState, actions) {
initializeDevtools(host, name, eventHub, initialState, actions, logLevel = 'error') {
if (utils.ENVIRONMENT === 'production')
return;
const devtools = new Devtools(name);
const devtools = new Devtools(name, logLevel);
devtools.connect(host, (message) => {

@@ -515,0 +600,0 @@ switch (message.type) {

@@ -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';

@@ -0,1 +1,2 @@

import { LogLevel } from './internalTypes';
export declare type Message = {

@@ -11,2 +12,3 @@ type: string;

export declare class Devtools {
private logLevel;
private safeClassNames;

@@ -23,3 +25,3 @@ private unsafeClassNames;

private name;
constructor(name: string);
constructor(name: string, logLevel?: LogLevel);
connect: (host: string, onMessage: (message: Message) => void) => void;

@@ -26,0 +28,0 @@ private reconnect;

@@ -7,3 +7,4 @@ "use strict";

class Devtools {
constructor(name) {
constructor(name, logLevel = 'error') {
this.logLevel = logLevel;
this.safeClassNames = new Set();

@@ -33,3 +34,3 @@ this.unsafeClassNames = new Set();

this.ws.onerror = () => {
console.error(`OVERMIND DEVTOOLS: Not able to connect. You are trying to connect to "${host}", but there was no devtool there. Try the following:
console[this.logLevel](`OVERMIND DEVTOOLS: Not able to connect. You are trying to connect to "${host}", but there was no devtool there. Try the following:

@@ -36,0 +37,0 @@ - Make sure you are running the latest version of the devtools, using "npx overmind-devtools@latest" or install latest extension for VSCode

@@ -9,2 +9,3 @@ import { IFlushCallback, IMutation, IMutationTree, ITrackStateTree } from 'proxy-state-tree';

}>;
export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
export declare type Options = {

@@ -18,2 +19,3 @@ delimiter?: string;

strict?: boolean;
devtoolsLogLevel?: LogLevel;
};

@@ -20,0 +22,0 @@ export declare type DefaultMode = {

@@ -5,3 +5,3 @@ import { EventEmitter } from 'betsy';

import * as internalTypes from './internalTypes';
import { IConfiguration, IReaction, IContext } from './types';
import { IConfiguration, IContext, IReaction } from './types';
export declare class Overmind<ThisConfig extends IConfiguration> implements IConfiguration {

@@ -8,0 +8,0 @@ private proxyStateTreeInstance;

@@ -132,3 +132,3 @@ "use strict";

: document.title || 'NoName';
this.initializeDevtools(host, name, eventHub, proxyStateTreeInstance.sourceState, configuration.actions);
this.initializeDevtools(host, name, eventHub, proxyStateTreeInstance.sourceState, configuration.actions, options.devtoolsLogLevel);
}

@@ -502,6 +502,6 @@ else if (options.devtools !== false) {

}
initializeDevtools(host, name, eventHub, initialState, actions) {
initializeDevtools(host, name, eventHub, initialState, actions, logLevel = 'error') {
if (utils.ENVIRONMENT === 'production')
return;
const devtools = new Devtools_1.Devtools(name);
const devtools = new Devtools_1.Devtools(name, logLevel);
devtools.connect(host, (message) => {

@@ -508,0 +508,0 @@ switch (message.type) {

{
"name": "overmind",
"version": "28.0.1",
"version": "28.0.2-1663316392640",
"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",
"betsy": "1.0.2-1663316392640",
"tslib": "^2.3.0",
"proxy-state-tree": "6.3.0"
"proxy-state-tree": "6.3.0-1663316392640"
},

@@ -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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc