
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@bedrock-core/network
Advanced tools
Rule‑driven directed graph abstraction. Nodes carry domain data plus an immutable set of edge‑generation rules. Edges are materialized when nodes are inserted, removed, or when data is updated via updateNodeData().
⚠️ Beta Status: This library is currently in active beta. Expect breaking changes in any release without prior deprecation warnings until a stable 1.0.0 is published. Pin exact versions if you need stability.
yarn add @bedrock-core/network
# or
npm install @bedrock-core/network
import { NetworkManager, Rule, RuleDirection } from '@bedrock-core/network';
interface Item { value: number }
const greaterThan: Rule<Item> = {
direction: RuleDirection.Outgoing, // initiates edges to smaller valued nodes when accepted
match: (s, t) => s.value > t.value,
};
const acceptSmaller: Rule<Item> = {
direction: RuleDirection.Incoming, // only accepts connections from higher valued nodes
match: (self, initiator) => initiator.value > self.value,
};
const mgr = new NetworkManager<Item>();
// Reuse the same rule object for multiple nodes (safe & common)
mgr.createNode('a', { value: 10 }, [greaterThan, acceptSmaller]);
mgr.createNode('b', { value: 5 }, [acceptSmaller]); // b can accept from higher but can't initiate upwards
mgr.createNode('c', { value: 20 }, [greaterThan, acceptSmaller]); // c can initiate to a & b (who accept),
// and a accepts c (a<-c) but b only accepts from higher so c->b edge forms; b has no outgoing to c.
The library provides two approaches for updating node data:
updateNodeData(): Updates data and recalculates all edges for the node
Direct mutation: Modify node.data directly via getNode(id).data
// Method 1: Recalculate edges
mgr.updateNodeData('nodeId', newData);
// Method 2: Direct mutation (no edge recalculation)
const node = mgr.getNode('nodeId')!;
node.data.someProperty = newValue;
Rule
{ direction?: 'outgoing'|'incoming'|'both'; match; targetFilter? }.targetFilter (optional) is only applied on the initiating side before calling match.Node
{ id, data, rules }.rules array captured at creation time; do not mutate (clone if composing).data can be mutated directly for performance, or via updateNodeData() for edge recalculation.Network
NetworkManager
targetFilter (if any) and match(N,E) succeed AND an accepting rule on E (incoming|both) whose match(E,N) succeeds.updateNodeData() recalculates edges for the updated node.Event: create node N
N.rules tested against every previously present node.Event: update node data via updateNodeData()
Event: direct data mutation
Event: remove node
To reflect data‑dependent rule outcomes after a direct data change, call updateNodeData() or remove and recreate the node.
You can (and should) define common rule instances once and supply them to many nodes:
const connectedIfEven: Rule<Item> = {
targetFilter: t => (t.value & 1) === 0,
match: (s, t) => (s.value & 1) === 0 // both even
};
mgr.createNode('n1', { value: 2 }, [connectedIfEven]);
mgr.createNode('n2', { value: 4 }, [connectedIfEven]); // edges formed here
Mutating connectedIfEven after nodes are created is undefined behavior (do not).
Edges are created per direction via handshake (initiator rule + acceptor rule). Reverse direction is independent. This permits:
const wantsAll: Rule<Item> = { direction: RuleDirection.Outgoing, match: () => true };
const onlyAcceptHigh: Rule<Item> = { direction: RuleDirection.Incoming, match: (self, init) => init.value > self.value };
// Node X (value 5) only has incoming acceptance; Node Y (value 10) has outgoing initiation.
// Y->X edge forms (Y initiates, X accepts). X->Y does NOT (X cannot initiate).
targetFilter when you can reject most candidates cheaply.match side‑effect free and allocation light (it may run many times per insertion).updateNodeData() when data changes should affect connectivity.updateNodeData() is called.MIT
FAQs
Rule-driven directed graph abstraction
The npm package @bedrock-core/network receives a total of 0 weekly downloads. As such, @bedrock-core/network popularity was classified as not popular.
We found that @bedrock-core/network 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.