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.
@studiohyperdrive/hal-tools
Advanced tools
WARNING: This package has been renamed to @studiohyperdrive/nodejs-hal-tools.
This repo contains a set of tools for working with HAL standards.
It is build with:
v12.20.0
( ~ lts/erbium
)6.14.8
For a complete list of packages and version check out the package.json
file.
You can install this package by doing:
$ npm install @studiohyperdrive/hal-tools
or if you use Yarn:
$ yarn add @studiohyperdrive/hal-tools
In your code, you can use this package and it's interfaces like this:
import { HALFormat } from '@studiohyperdrive/hal-tools';
class DoSomething {
public async findAll(page: number, size: number): Promise<IHALFormat<MyEntity>> {
const [entities, totalElements] = await this.MyEntitiyRepository.findAndCount(
calculateTakeSkip(page, size),
);
const key = 'my-entities';
const path = `https://my-api.com/v1/api/${key}`;
return HALFormat<MyEntity>({
path,
key,
entities,
page,
size,
totalElements,
});
}
}
This will transform your entities and count to a HAL formatted response which you can return to the client.
This package exposes the following functions:
calculateTotalPages
: This function will calculate the total amount of pages based on the pagesize & total amount of items.calculatePagination
: This function will calculate and return all pagination properties.calculateNextPage
: This function will calculate your next page or, when there is none, return your current page.createHalLinks
: This function will create a set of links required by the HAL Format.HALFormat
: This function is the main one which will use the above and your input to transform your input to a HAL-formatted object.And the following interfaces:
IHALLink
: An interface for a single HAL link.IHALLinks
: An interface for the _links
property.IHALEntities
: An interface for the _embedded
property, takes in an optional T
.IHALPagination
: An interface for the _page
property.IHALFormat
: An interface for the HAL formatted object containing the above properties.IHALFormatParams
: An interface for the arguments of the HALFormat
function.To setup this project, clone the repo and run npm i
to install the dependencies.
The available commands for building the project are:
command | runs |
---|---|
build | This script runs tsc to compile and your code (target to the dist folder). |
prepare | This script runs the npm run build command, it is a hook on the npm publish. |
The available commands for testing the project are:
command | runs |
---|---|
lint | This script will run linting and fix what it can. |
test | This script will run your Jest tests for the library and create a coverage report. |
test | This script will run your Jest tests but with the --watchAll flag. It does not create a coverage report. |
This project can be published to the npm registry. To do so follow these steps:
npm version <major | minor | patch>
to create a new version and commit + tag it.npm publish
.This project has been created by:
It is currently maintained by:
FAQs
## General
The npm package @studiohyperdrive/hal-tools receives a total of 0 weekly downloads. As such, @studiohyperdrive/hal-tools popularity was classified as not popular.
We found that @studiohyperdrive/hal-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers 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.