Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@clipboard-health/json-api
Advanced tools
Utilities for adhering to the [JSON:API](https://jsonapi.org/) specification.
Utilities for adhering to the JSON:API specification.
npm install @clipboard-health/json-api
From the client, call toSearchParams
to convert from JsonApiQuery
to URLSearchParams
:
// ./examples/toSearchParams.ts
import { toSearchParams } from "@clipboard-health/json-api";
import { type JsonApiQuery } from "../src/lib/types";
const query: JsonApiQuery = {
fields: { dog: ["age", "name"] },
filter: { age: ["2", "5"] },
include: ["vet"],
page: { size: "10" },
sort: ["-age"],
};
console.log(toSearchParams(query).toString());
// Note: actual result is URL-encoded, but unencoded below for readability
// => fields[dog]=age,name&filter[age]=2,5&include=vet&page[size]=10&sort=-age
From the server, call toJsonApiQuery
to convert from URLSearchParams
to JsonApiQuery
:
// ./examples/toJsonApiQuery.ts
import { toJsonApiQuery } from "@clipboard-health/json-api";
const searchParams = new URLSearchParams(
"fields%5Bdog%5D=age%2Cname&filter%5Bage%5D=2%2C5&include=vet&page%5Bsize%5D=10&sort=-age",
);
console.log(toJsonApiQuery(searchParams));
// => {
// fields: { dog: ["age", "name"] },
// filter: { age: ["2", "5"] },
// include: ["vet"],
// 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 1,309 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 0 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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.