
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@clipboard-health/json-api
Advanced tools
TypeScript-friendly utilities for adhering to the JSON:API specification.
TypeScript-friendly utilities for adhering to the JSON:API specification.
npm install @clipboard-health/json-api
From the client, call stringifyQuery
to convert from JsonApiQuery
to URLSearchParams
:
import { deepEqual } from "node:assert/strict";
import { stringifyQuery } from "@clipboard-health/json-api";
import { type ClientJsonApiQuery } from "../src/lib/types";
const [date1, date2] = ["2024-01-01", "2024-01-02"];
const query: ClientJsonApiQuery = {
fields: { user: ["age", "dateOfBirth"] },
filter: {
age: 2,
dateOfBirth: {
gt: date1,
lt: date2,
},
isActive: true,
},
include: "article",
page: {
size: 10,
},
sort: "-age",
};
deepEqual(
stringifyQuery(query),
new URLSearchParams(
`fields[user]=age,dateOfBirth&filter[age]=2&filter[dateOfBirth][gt]=${date1}&filter[dateOfBirth][lt]=${date2}&filter[isActive]=true&include=article&page[size]=10&sort=-age`,
).toString(),
);
From the server, call parseQuery
to convert from URLSearchParams
to ServerJsonApiQuery
:
import { deepEqual } from "node:assert/strict";
import { parseQuery } from "@clipboard-health/json-api";
import { type ServerJsonApiQuery } from "../src/lib/types";
const [date1, date2] = ["2024-01-01", "2024-01-02"];
// The URLSearchParams constructor also supports URL-encoded strings
const searchParams = new URLSearchParams(
`fields[user]=age,dateOfBirth&filter[age]=2&filter[dateOfBirth][gt]=${date1}&filter[dateOfBirth][lt]=${date2}&filter[isActive]=true&include=article&page[size]=10&sort=-age`,
);
const query: ServerJsonApiQuery = parseQuery(searchParams.toString());
deepEqual(query, {
fields: { user: ["age", "dateOfBirth"] },
filter: {
age: "2",
dateOfBirth: { gt: date1, lt: date2 },
isActive: "true",
},
include: "article",
page: {
size: "10",
},
sort: "-age",
});
See package.json
scripts
for a list of commands.
FAQs
TypeScript-friendly utilities for adhering to the JSON:API specification.
The npm package @clipboard-health/json-api receives a total of 3,630 weekly downloads. As such, @clipboard-health/json-api popularity was classified as popular.
We found that @clipboard-health/json-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.