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.0-1614522025331 to 28.0.0-1614633297417

32

es/index.test.js

@@ -50,2 +50,19 @@ import { __awaiter } from "tslib";

};
const changeOptionalFoo = (context, newFoo) => {
if (newFoo !== undefined) {
context.state.foo = newFoo;
}
else {
context.state.foo = 'default-foo';
}
};
const asyncChangeOptionalFoo = (context, newFoo) => __awaiter(this, void 0, void 0, function* () {
yield Promise.resolve();
if (newFoo !== undefined) {
context.state.foo = newFoo;
}
else {
context.state.foo = 'async-default-foo';
}
});
const changeFormValue = (_, payload) => {

@@ -68,2 +85,4 @@ const { form, key, value } = payload;

rehydrateAction,
changeOptionalFoo,
asyncChangeOptionalFoo
};

@@ -394,3 +413,16 @@ const effects = {

});
test('should allow actions with optional parameter', () => __awaiter(void 0, void 0, void 0, function* () {
const app = createDefaultOvermind();
app.actions.changeOptionalFoo();
expect(app.state.foo).toBe('default-foo');
yield app.actions.asyncChangeOptionalFoo();
expect(app.state.foo).toBe('async-default-foo');
const newFoo = 'new-foo';
app.actions.changeOptionalFoo(newFoo);
expect(app.state.foo).toBe(newFoo);
const newAsyncFoo = 'new-async-foo';
yield app.actions.asyncChangeOptionalFoo(newAsyncFoo);
expect(app.state.foo).toBe(newAsyncFoo);
}));
});
//# sourceMappingURL=index.test.js.map

2

es/internalTypes.d.ts

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

};
export declare type ResolveAction<T> = T extends IOperator<void, infer R> ? () => Promise<R> : T extends IOperator<infer P, infer R> ? (payload: P) => Promise<R> : T extends IAction<void, infer R> ? () => R : T extends IAction<infer P, infer R> ? (payload: P) => R : T extends NestedActions ? {
export declare type ResolveAction<T> = T extends IOperator<void, infer R> ? () => Promise<R> : T extends IOperator<infer P | undefined, infer R> ? (payload?: P) => Promise<R> : T extends IOperator<infer P, infer R> ? (payload: P) => Promise<R> : T extends IAction<void, infer R> ? () => R : T extends IAction<infer P | undefined, infer R> ? (payload?: P) => R : T extends IAction<infer P, infer R> ? (payload: P) => R : T extends NestedActions ? {
[K in keyof T]: ResolveAction<T[K]>;

@@ -139,0 +139,0 @@ } : never;

@@ -52,2 +52,19 @@ "use strict";

};
const changeOptionalFoo = (context, newFoo) => {
if (newFoo !== undefined) {
context.state.foo = newFoo;
}
else {
context.state.foo = 'default-foo';
}
};
const asyncChangeOptionalFoo = (context, newFoo) => tslib_1.__awaiter(this, void 0, void 0, function* () {
yield Promise.resolve();
if (newFoo !== undefined) {
context.state.foo = newFoo;
}
else {
context.state.foo = 'async-default-foo';
}
});
const changeFormValue = (_, payload) => {

@@ -70,2 +87,4 @@ const { form, key, value } = payload;

rehydrateAction,
changeOptionalFoo,
asyncChangeOptionalFoo
};

@@ -396,3 +415,16 @@ const effects = {

});
test('should allow actions with optional parameter', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const app = createDefaultOvermind();
app.actions.changeOptionalFoo();
expect(app.state.foo).toBe('default-foo');
yield app.actions.asyncChangeOptionalFoo();
expect(app.state.foo).toBe('async-default-foo');
const newFoo = 'new-foo';
app.actions.changeOptionalFoo(newFoo);
expect(app.state.foo).toBe(newFoo);
const newAsyncFoo = 'new-async-foo';
yield app.actions.asyncChangeOptionalFoo(newAsyncFoo);
expect(app.state.foo).toBe(newAsyncFoo);
}));
});
//# sourceMappingURL=index.test.js.map

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

};
export declare type ResolveAction<T> = T extends IOperator<void, infer R> ? () => Promise<R> : T extends IOperator<infer P, infer R> ? (payload: P) => Promise<R> : T extends IAction<void, infer R> ? () => R : T extends IAction<infer P, infer R> ? (payload: P) => R : T extends NestedActions ? {
export declare type ResolveAction<T> = T extends IOperator<void, infer R> ? () => Promise<R> : T extends IOperator<infer P | undefined, infer R> ? (payload?: P) => Promise<R> : T extends IOperator<infer P, infer R> ? (payload: P) => Promise<R> : T extends IAction<void, infer R> ? () => R : T extends IAction<infer P | undefined, infer R> ? (payload?: P) => R : T extends IAction<infer P, infer R> ? (payload: P) => R : T extends NestedActions ? {
[K in keyof T]: ResolveAction<T[K]>;

@@ -139,0 +139,0 @@ } : never;

{
"name": "overmind",
"version": "28.0.0-1614522025331",
"version": "28.0.0-1614633297417",
"description": "Frictionless state management",

@@ -38,6 +38,6 @@ "author": "Christian Alfoni <christianalfoni@gmail.com>",

"is-plain-obj": "^1.1.0",
"betsy": "1.0.2-1614522025331",
"non-blocking-json": "1.1.1-1614522025331",
"betsy": "1.0.2-1614633297417",
"non-blocking-json": "1.1.1-1614633297417",
"tslib": "^1.10.0",
"proxy-state-tree": "6.3.0-1614522025331"
"proxy-state-tree": "6.3.0-1614633297417"
},

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

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