Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
H.A.L. (Hypertext Application Language) TypeScript declarations and functions.
npm i -P @jalik/hal
yarn add @jalik/hal
import { createHalResource } from '@jalik/hal'
const user = {
username: 'admin'
}
const roles = [
{ name: 'administrator' }
]
// we can add links to roles (optional)
const rolesResources = roles.map((role) => createHalResource(role, undefined, {
self: { href: `http://localhost/roles/${role.name}` }
}))
const embedded = {
roles: rolesResources
}
const links = {
self: { href: 'http://localhost/users/admin' }
}
const resource = createHalResource(user, embedded, links)
import { createHalPagedResource } from '@jalik/hal'
const users = [
{ username: 'admin' },
{ username: 'john' }
]
// we can add links to users (optional)
const usersResources = users.map((user) => createHalResource(user, undefined, {
self: { href: `http://localhost/users/${user.username}` }
}))
const embedded = {
users: usersResources
}
const page = {
number: 3,
size: 2,
totalElements: 10,
totalPages: 5
}
const links = {
first: 'http://localhost/users?p=1',
prev: 'http://localhost/users?p=2',
self: 'http://localhost/users?p=3',
next: 'http://localhost/users?p=4',
last: 'http://localhost/users?p=5',
}
const resource = createHalPagedResource(embedded, page, links)
import { getHalEmbedded } from '@jalik/hal'
const doc = {
username: 'admin',
_embedded: {
roles: [
{ name: 'administrator' },
{ name: 'member' }
]
}
}
const embedded = getHalEmbedded(doc)
// embedded = { roles[] }
import { getHalLinks } from '@jalik/hal'
const doc = {
username: 'admin',
_links: {
self: { href: 'http://localhost/users/admin' }
}
}
const links = getHalLinks(doc)
// links = { self }
import { getHalPage } from '@jalik/hal'
const doc = {
_embedded: { users: [] },
page: {
number: 1,
size: 0,
totalElements: 0,
totalPages: 1
}
}
const page = getHalPage(doc)
// page = { number, size, totalElements, totalPages }
History of releases is in the changelog on GitHub.
The code is released under the MIT License.
FAQs
Hypertext Application Language toolbox
The npm package @jalik/hal receives a total of 14 weekly downloads. As such, @jalik/hal popularity was classified as not popular.
We found that @jalik/hal 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.