The Hyperjump browser is a hypermedia client for JRef and other
JRef-compatible media types. JRef is JSON with references such as
{ "$ref": "../people/1" }. The browser retrieves documents over HTTP or from
files and follows the references between them for you, so you can work with
linked documents as if they were one value.
import { Hyperjump, jrefStep, jrefValue } from "@hyperjump/browser";
const h = new Hyperjump({
allowRetrieval: ["https://swapi.hyperjump.io/"]
});
const session = h.session();
const film = await session.get("https://swapi.hyperjump.io/api/films/1");
const director = await jrefStep(session, "director", film);
jrefValue(director); // "George Lucas"- Safe with documents you don't trust. A document can't make your app retrieve whatever it references. You choose what the browser can retrieve.
- HTTP done properly. Responses are cached according to their caching headers and stale ones are revalidated.
- Extensible. Add your own media types and URI schemes.
- Built for unified. Documents are parsed into ASTs that keep source locations, and the parsers and stringifiers work as unified plugins.
- Node.js and browsers. It runs on the server and in web browsers.
@hyperjump/json-schema v2
builds on the Hyperjump browser.
npm install @hyperjump/browserThis branch is version 2, which isn't released yet. The released version is 1.x and its docs are in the 1.x README.
The documentation is in website/. Start with
Get started, which browses an API and then files
step by step.
The design docs, principles, and style guide are in
design/. Read the documents about the part you're working
on before you change it.
npm test # Run the tests
npm test -- --watch # Run the tests when files change
npm run lint
npm run type-checkThe docs are checked with Vale. Run vale sync once to
download the styles, then run vale website design.