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

syncher-api

v0.0.22

Published

extended fetch api with synch and auth apis

Readme

AJAXNESS

Ajaxness contains an extended fetch API with SWR caching extensions. It also contains a specialized Synch API for RESTful CRUD and a minimalist Auth API for bearer authentication with JWT and oAuth.

fetch API

Extended fetch api with SWR settings features (caching, retry, etc).

import { fetch } from 'react-'

// swr caching support

const cache = 42000
const cacheKeys = ['todos', 'ok']

fetch(url, { cache })   
fetch(url, { cache: "7min" })
fetch(url, { cache, cacheKeys })   
fetch(url, { cache: "no-cache" })   
fetch(url, { cache: "force-cache" })   

// revalidate (clear cache)

fetch.clear(cacheKeys)
fetch.clear()  // all
// swr features

const callback = e => console.log(e)
const retry = { repeat:3, interval:1000 }
const reget = { interval:1000, callback }
await fetch("http://etc.com", { retry })
await fetch("http://etc.com", { reget })

// auth token state

fetch.token = `Bearer ${token}`

// easy interceptors

fetch.on("request", req => ...)
fetch.on("response", res => ...)
fetch.on("exception", err => ...)

Synch API

RESTful fluent API for synchornization semantics.

import { syncher } from 'react-'

const messageApi = syncher<User>(true)
   .fetch("http://message.api/baseURL")
   .catch(e => "not found...")
   .match(x => x, "id")   

// message Api is a ISync type

interface ISync<T,E> {   
   value: T
   await: boolean
   error: E|undefined
   async(mutate?): Promise<void>
}
// sync search/mutate flag

sync()      // querying sync
sync(true)  // mutation sync

// support SWR methods

const messageApi = syncher<User>(true)
   .retry(3, 1000)
   .cache(1000, ["messages", 1])
   .reget(1000, x => "pooling...")
   .fetch("http://message.api/baseURL")
   .catch(e => "not found...")
   .match(x => x, "id")   

Auth API

Simple fluent authentication API for JWT Bearer and oAuth authentication.

import { auth } from 'ajaxness'

// JWT bearer + basic Auth

interface Token { access: string }
interface User { role: string }

const session = auth<User>(false)
   .fetch("http://www.google.com/login")
   .catch("/login", "Login fails")
   .match<Token>("/home", x => x.token)

// oAuth provider support

const googleAuth = {
   scopings: ['profile', 'email'],
   clientId: 'asdfasfsadfasdfasdf.apps.googleusercontent.com',
   queryURL: 'https://www.googleapis.com/oauth2/v3/userinfo',
   tokenURL: 'https://accounts.google.com/o/oauth2/auth'
}

const session = auth(true, googleAuth)
   .catch('/index.html', 'failed login...')
   .match('/poc/home.html', x => x.access_token)

// login and logout behavior

await session.login(username, password)
const user = session.logged
session.logout()