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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@encephalon/sdk

v0.0.1

Published

javascript sdk for encephalon api

Downloads

4

Readme

Universal JavaScript SDK for the Encephalon Engine API

This client is a thin wrapper for the Encephalon API to use in Node.js and the browser.

Install

npm install @encephalon/sdk

Usage

encephalon exposes a single function that takes a single options object for configuration and returns the client

options

token string

The access token. You can find or create one in your dashboard

cache (optional)

Allows custom cache implementation, defaults to memory

ttl integer (optional)

A cache entry's time to live in ms, defaults to 3600000

maxRetries integer (optional)

Number of attempts to retry a request if an error occurs, defaults to 2

timeout integer (optional)

How long before the request aborts in ms, defaults to 5000

concurrency integer (optional)

Max concurrent requests, defaults to 3

interval integer (optional)

Duration of delay between requests to avoid API rate limits, defaults to 16

Example

// require encephalon
import encephalon from '@encephalon/sdk';

// create a client with your access token
const client = encephalon({
  token: '{YOUR_ACCESS_TOKEN}',
});

// make requests
await client.get(`experiences/${id}`);

await client.post(`experiences/${id}`)
  .send({ name: 'hello' });
  
await client.delete(`experiences/${id}`);

Methods

all, get, post, put, patch, delete

All requests take a string for the API path and return a thenable superagent object. See the Example section above.

await client.all(`experiences`);
await client.get(`experiences/${id}`);
await client.post(`experiences/${id}`)
  .send({ name: 'hello' });
await client.delete(`experiences/${id}`);

cachebust

Ignores the cache and cachebusts the URL

await client.get(`experiences/${id}`)
  .cachebust();

page

For pagination, sets the page number

await client.all(`experiences`)
  .page(2);

perPage

For pagination, sets quantity per page

await client.all(`experiences`)
  .perPage(5);

token

Sets the token with the passed value. Can also be used as a getter.

client.token('{TOKEN}'); // sets token

const tkn = client.token(); // gets token

Cache

Documentation is a WIP

Testing

To run the test suite:

  1. Open a terminal and navigate to the project
  2. run npm install
  3. run npm test

Please see the package.json engines for supported environments