
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
A JavaScript browser event based communication BUS
# with npm
npm i --save combus
# with yarn
yarn add combus
// injector.js
import combus from 'combus';
const injectables = new Map();
combus.listen('getInstance', async message => {
const { name, args } = message.payload;
if (!injectables.has(name)) {
return new Error(`Injectable ${name} is not registered`);
}
return Reflect.construct(injectables.get(name), [].concat(args));
});
combus.listen('inject', async message => {
const { name, injectable } = message.payload;
if (injectables.has(name)) {
return new Error(`Injectable ${name} is already registered`);
}
injectables.set(name, injectable);
});
// injectables-stuff.js
import combus from 'combus';
class Foo {
constructor(param1, param2) {
this.param1 = param1;
this.param2 = param2;
}
sum() {
return this.param1 + this.param2;
}
}
class Foo2 {
constructor(arr) {
this.arr = arr;
}
sum() {
return this.arr.reduce((s, c) => s + c, 0);
}
}
combus.dispatch('inject', {
name: Foo.name,
injectable: Foo,
});
combus.dispatch('inject', {
name: Foo2.name,
injectable: Foo2,
});
// file-which-will-retrieve-the-injectable.js
import combus from 'combus';
Promise.all([
combus.dispatch('getInstance', {
name: 'Foo',
args: [5, 10]
}),
combus.dispatch('getInstance', {
name: 'Foo2',
args: [1, 2, 3, 4]
}),
]).then(([fooMessage, foo2Message]) => {
const foo = fooMessage.payload;
const foo2 = foo2Message.payload;
console.log(foo.sum()) // 15
console.log(foo2.sum()) // 10
});
Combus can be used to create a dialogue between different bundles (and different frameworks or libraries).
// bundle.1.js
import combus from 'combus';
const secret = 123;
combus.listen('give-me-your-secret', async message => {
return `Hello ${message.payload}, the secret is ${secret}`;
});
// bumdle.2.js
import combus from 'combus';
combus.dispatch('give-me-your-secret', 'bundle.2').then(response => {
console.log(response); // Hello bundle.2 , the secret is 123
});
// bumdle.3.js
import combus from 'combus';
combus.dispatch('give-me-your-secret', 'bundle.3').then(response => {
console.log(response); // Hello bundle.3 , the secret is 123
});
Combus could be useful to create a state machine
// state-machine.js
import { listen } from 'combus';
const state = {
todos: [],
};
listen('get', async () => state);
listen('add', async message => {
state.todos.push(message.payload);
return state;
});
listen('toggle', async message => {
state.todos.forEach(todo => {
if (todo.id !== message.payload) {
return;
}
todo.completed = !todo.completed;
});
return state;
});
listen('remove', async message => {
state.todos = state.todos.filter(i => i.id !== message.payload);
return state;
});
// your-logic.js
import { dispatch } from 'combus';
function create(id, name) {
return {
completed: false,
id,
name,
}
}
(async function main() {
const todos = (await dispatch('get')).payload;
await dispatch('add', create(0, 'foo'));
await dispatch('add', create(1, 'bar'));
await dispatch('add', create(2, 'baz'));
await dispatch('toggle', 2);
await dispatch('remove', 0);
await dispatch('remove', 1);
const remainingTodos = (await dispatch('get')).payload;
console.log(remainingTodos); // [{ id: 2, name: 'baz', completed: true }];
})();
FAQs
Event based communication bus for JavaScript and TypeScript
The npm package combus receives a total of 0 weekly downloads. As such, combus popularity was classified as not popular.
We found that combus demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.