
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
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.
@siren-js/core
Advanced tools
Cross-platform library of classes for generating and parsing Siren entities
Cross-platform library of classes for generating and parsing Siren entities.
npm install @siren-js/core
Here's a simple example of generating an entity:
import * as Siren from '@siren-js/core';
const person = Siren.Entity.of({
class: ['Person'],
properties: {
givenName: 'Neville',
familyName: 'Longbottom',
birthDate: '1980-07-30'
},
links: [
{
rel: ['self'],
href: 'https://api.example.com/people/69'
}
]
});
Here is a more complete example building out the order entity example from the Siren spec:
const order = {
orderNumber: 42,
itemCount: 3,
status: 'pending',
customer: {
userId: 'pj123',
name: 'Peter Joseph'
}
};
const orderEntity = Siren.Entity.of({
class: ['order'],
properties: {
orderNumber: order.orderNumber,
itemCount: order.itemCount,
status: order.status
},
entities: [
{
class: ['items', 'collection'],
rel: ['http://x.io/rels/order-items'],
href: `http://api.x.io/orders/${order.orderNumber}/items`
},
{
class: ['info', 'customer'],
rel: ['http://x.io/rels/customer'],
properties: {
customerId: order.customer.userId,
name: order.customer.name
},
links: [
{
rel: ['self'],
href: `http://api.x.io/customers/${order.customer.userId}`
}
]
}
],
actions: [
{
name: 'add-item',
title: 'Add Item',
method: 'POST',
href: `http://api.x.io/orders/${order.orderNumber}/items`,
type: 'application/x-www-form-urlencoded',
fields: [
{ name: 'orderNumber', type: 'hidden', value: `${order.orderNumber}` },
{ name: 'productCode', type: 'text' },
{ name: 'quantity', type: 'number' }
]
}
],
links: [
{
rel: ['self'],
href: `http://api.x.io/orders/${order.orderNumber}`
},
{
rel: ['previous'],
href: `http://api.x.io/orders/${order.orderNumber - 1}`
},
{
rel: ['next'],
href: `http://api.x.io/orders/${order.orderNumber + 1}`
}
]
});
Use the stringify function to convert an Entity into Siren JSON (application/vnd.siren+json).
const siren = Siren.stringify(person);
// => "{ "class": ["Person"], ... }"
Use the parse function to convert a Siren JSON string to an Entity.
const entity = Siren.parse(siren);
// `entity` is equivalent to `person`
The Entity class provides several convenience methods for finding actions or links within the entity:
const addItemAction = orderEntity.findActionByName('add-item');
const customerSubEntities = orderEntity.findEntitiesByRel('customer');
const nextOrderLinks = orderEntity.findLinksByRel('next');
The Action class also provides convenience methods for finding fields:
const productCodeField = addItemAction.findFieldByName('productCode');
Extensions are supported for every type of object. Here's an example using min and max constraints for a Field and hreflang for a Link:
Siren.Entity.of({
actions: [
{
name: 'guess-number',
href: 'https://api.example.com/guess',
fields: [
{
name: 'guess',
type: 'number',
min: 0,
max: 100
}
]
}
]
links: [
{
rel: ['about'],
href: 'https://api.example.com/about',
hreflang: 'en-US'
}
]
});
PRs and bug reports welcome! Be sure to read our contribution guidelines.
FAQs
Cross-platform library of classes for generating and parsing Siren entities
We found that @siren-js/core 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.

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.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.