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

@adatechnology/notification-client

v0.1.0

Published

Isomorphic notification client — typed HTTP, device registration and SSE. Runs in React Native, web, Node and Bun.

Readme

@adatechnology/notification-client

Cliente isomórfico das rotas de notificação: HTTP tipado, registro de device e stream de tempo real. Roda em React Native, web, Node e Bun com o mesmo código.

Sem dependência de framework — o notification-ui é construído sobre ele, mas não é obrigatório.

Instalação

bun add @adatechnology/notification-client

Uso

import { createNotificationClient } from '@adatechnology/notification-client'

const client = createNotificationClient({
  baseUrl: 'https://api.exemplo.com/v1',
  getAuthHeaders: async () => ({ authorization: `Bearer ${await session.accessToken()}` }),
})

const page = await client.listNotifications({ cursor })
const unread = await client.countUnread()
await client.markAsRead(notificationId)

getAuthHeaders é função, não valor: token de vida curta é renovado entre uma chamada e outra, e capturar o header no boot deixaria o cliente autenticando com credencial vencida depois de 15 minutos.

Tempo real sem EventSource

const { url, headers } = await client.resolveStreamRequest()

const subscription = subscribeToNotificationStream({
  url,
  headers,
  onEvent: () => queryClient.invalidateQueries(),
})

resolveStreamRequest existe para o assinante reaproveitar a base e os headers já resolvidos, em vez de o chamador remontar a URL e o token por fora e os dois saírem de sincronia.

A EventSource da plataforma não é usada, de propósito. Ela não aceita cabeçalho — o token teria que ir na query string, onde vaza para log de servidor, histórico e referer (security.md §8). E o React Native não a tem nativamente. A implementação usa fetch + ReadableStream, que resolve os dois problemas de uma vez e funciona igual nos quatro ambientes.

Reconexão com backoff exponencial e retomada por Last-Event-ID estão incluídas.

Registro de device

import { createDeviceRegistration } from '@adatechnology/notification-client'

Registra o token de push e remove no logout — device que continua registrado depois da saída manda notificação da conta antiga para o aparelho.

Licença

MIT © Ada Technology