
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@ecosy/store
Advanced tools
Lightweight state management with slices, reducers, and event-driven architecture
Lightweight state management with slices, reducers, and event-driven architecture for TypeScript applications.
npm install @ecosy/store
# or
yarn add @ecosy/store
Note:
@ecosy/coreis installed automatically as a dependency.
createSliceCreates a state slice with auto-generated action creators, a reducer, and event channels.
import { createSlice, type PayloadAction } from "@ecosy/store";
const counterSlice = createSlice({
name: "counter",
initialState: { count: 0 },
reducers: {
increment: (state) => ({ ...state, count: state.count + 1 }),
decrement: (state) => ({ ...state, count: state.count - 1 }),
add: (state, action: PayloadAction<number>) => ({
...state,
count: state.count + action.payload,
}),
},
});
// Auto-generated action creators
counterSlice.actions.increment();
// => { type: "$counter:increment" }
counterSlice.actions.add(5);
// => { type: "$counter:add", payload: 5 }
// Reducer
const next = counterSlice.reducer({ count: 0 }, counterSlice.actions.add(5));
// => { count: 5 }
// Event channels
counterSlice.events;
// => { counter: { increment: "$counter:increment", decrement: "$counter:decrement", add: "$counter:add" } }
createStoreCreates a store backed by a Subscriber instance with event wiring and typed actions.
import { createStore } from "@ecosy/store";
const { store, actions } = createStore({
name: "app",
initialState: { theme: "light" },
reducers: {
toggleTheme: (state) => ({
...state,
theme: state.theme === "light" ? "dark" : "light",
}),
},
});
// Listen to state changes
store.onStateChange((state) => {
console.log("Theme:", state.theme);
});
// Dispatch actions
actions.toggleTheme(); // logs "Theme: dark"
// Get current state
store.getState(); // { theme: "dark" }
Fire-and-forget events that don't modify state:
const { store, actions } = createStore({
initialState: { count: 0 },
reducers: {
increment: (state) => ({ ...state, count: state.count + 1 }),
},
signals: ["reset", "sync"],
});
// Signals are available as actions
actions.signals.reset();
actions.signals.sync();
| Type | Description |
|---|---|
PayloadAction<P, T, M, D> | Action with optional payload, meta, and delta |
AnyAction | PayloadAction<any, any, any, any> |
Reducers<State, Action> | Map of reducer handlers |
Slice<State, R, N> | Return type of createSlice |
CreateStoreOptions | Options for createStore |
CreateStoreReturn | Return type of createStore |
getType(prefix, key)Generates event channel strings:
import { getType } from "@ecosy/store";
getType("counter", "increment"); // "$counter:increment"
| Package | Description |
|---|---|
@ecosy/core | Types, utilities, and pub/sub subscriber |
@ecosy/react | React hooks for @ecosy/store |
MIT
FAQs
Lightweight state management with slices, reducers, and event-driven architecture
The npm package @ecosy/store receives a total of 18 weekly downloads. As such, @ecosy/store popularity was classified as not popular.
We found that @ecosy/store demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.