npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hippiemedia/agent

v2.0.0

Published

## TL;DR

Readme

hippiemedia/agent

TL;DR

import factory from '@hippiemedia/agent';

agent = factory();
let resource = await agent.follow('http://haltalk.herokuapp.com/');

What ?

An hypermedia agent capable of discovering and navigating a web of linked resources.

How ?

npm install @hippiemedia/agent

build webpack bundle

npm install
npm run build

Then you can create an agent. It's like your browser, but it understands more hypermedia formats:

import factory from '@hippiemedia/agent';

agent = factory();
  • html [ ]
  • ld+json (+hydra) [ ]
  • hal+json [x]
  • hal-forms [x]
  • vnd.api+json [ ]
  • collection+json [ ]
  • uber+json [ ]
  • your own adapter...

This agent is capable of fetching a resource, parsing its content based on its content type,
and populating a Resource object with operations, links and queries.

Discoverability

It's important to let the agent discover links instead of hardcoding them.
You can do that by introspecting resources:

let menu = resource.allLinks.map(link => render(`<a href="${link.href}">${link.rel}</a>`));

let actions = resource.operations.map(o => render(`<form method="${o.method}" action="${o.href}">
    ${o.fields.map(field => render(`<input type=${field.type} />`))}
</form>`));

Operations

You can apply some operations on a resource, like POSTing a new resource to a collection, or DELETE a resource.

let resource = await agent.follow('http://some-hypermedia-api.com/resource1');
let newResource = await resource.follow('comment').then(r => {
    r.operation('default').fill({
        author: 'me',
        text: 'fuck yeah'
    }).submit()
});

Links

You can follow links as you follow them in your browser.

let resource = await agent.follow('http://some-hypermedia-api.com/resource1');
console.log(resource.allLinks);
let comments = await resource.followAll('comments');

Queries

Some links can be templated. You can expand them using:

let found = await resource.follow('find', {name: 'yay', 'year': 2018});

Why ?

The current state of http APIs sucks. Everybody makes its own shit in its own corner
without embracing what made the web so successful (hateoas, links, auto-discovery, ...)

json-ld + hydra is the future, yet everybody tries to replace poor REST with graphql,
thinking that graphql replaces REST (while it's only complementary at best),
thinking that client-side-hardcoded-server-structure is better than auto-discovered, self-documented, dumb[1] clients,
thinking that json is better that xml,
thinking that raw-data structures worth anything without its semantics,
thinking that hardcoding URLs client-side and API versioning is better than letting the server do the job.
/rant

[1] dumb clients are actually smart: they know as much about your API than firefox knows about just another mother fucking website.
Yet this very same browser is capable of displaying it and any other website. Now who's smart?