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

@rodrigoaraujotl/sdk-uappi

v0.1.2

Published

SDK TypeScript compatível com Next.js para consumo das APIs Front v2 da Uappi.

Readme

SDK Uappi Front v2

SDK TypeScript para facilitar o consumo das APIs Front v2 da Uappi/Wapstore em projetos Next.js.

A documentação oficial informa que as APIs front são públicas, exigem o header App-Token com valor padrão wapstore, podem usar o header Session para operações associadas ao comprador e retornam headers úteis como Request-Id, X-RateLimit-Limit e X-RateLimit-Remaining: https://developers.uappi.com.br/docs/uappi/api/v2/front

Instalação

npm install @rodrigoaraujotl/sdk-uappi

Enquanto o pacote não estiver publicado, use este repositório como workspace/package local no projeto Next.js.

Compatibilidade com Next.js

  • Não depende de APIs exclusivas do Node.js em runtime.
  • Usa fetch, disponível no Next.js em Server Components, Route Handlers, Server Actions e no browser.
  • Aceita opções do fetch do Next.js, como next: { revalidate, tags }.
  • Permite injetar uma implementação de fetch para testes, observabilidade ou wrappers internos.

Uso básico

import { UappiClient } from '@rodrigoaraujotl/sdk-uappi';

export const uappi = new UappiClient({
  baseUrl: process.env.UAPPI_API_URL!, // Ex.: https://sua-loja.com.br/api
  appToken: process.env.UAPPI_APP_TOKEN ?? 'wapstore',
  userAgent: 'MinhaLoja/1.0', // recomendado para chamadas server-side em produção
});

Exemplo em Server Component

import { uappi } from '@/lib/uappi';

export default async function BrandsPage() {
  const { data } = await uappi.front.brands.list(undefined, {
    next: { revalidate: 300, tags: ['uappi-brands'] },
  });

  return (
    <ul>
      {data.marcas.map((marca) => (
        <li key={marca.id}>{marca.nome}</li>
      ))}
    </ul>
  );
}

Exemplo com sessão do comprador

import { cookies } from 'next/headers';
import { UappiClient } from '@rodrigoaraujotl/sdk-uappi';

export async function getCart() {
  const session = cookies().get('uappi-session')?.value;

  const client = new UappiClient({
    baseUrl: process.env.UAPPI_API_URL!,
    session,
  });

  return client.front.checkout.getCart({ cache: 'no-store' });
}

Também é possível atualizar a sessão em uma instância existente:

uappi.setSession('session-id');

Recursos tipados disponíveis

await uappi.front.brands.list({ ativo: true });
await uappi.front.checkout.getCart();
await uappi.front.evaluations.store.validateAddKey('chave');
await uappi.front.evaluations.store.list({ offset: 0, limit: 100, codigoPais: 'bra|usa' });
await uappi.front.categories.compatibility.removeActual();
await uappi.front.questions.create({ idProduto: 123, pergunta: 'Esse produto tem garantia?' });
await uappi.front.giftsList.getTypes({ tipo: 'presenteado', offset: 0, limit: 100 });
await uappi.front.giftsList.removeActual();
await uappi.front.representative.get();
await uappi.front.representative.set('hash-do-representante');
await uappi.front.trackingParameters.set({
  utm_source: 'google',
  utm_campaign: 'campanha',
  utm_medium: 'cpc',
});

Chamadas para endpoints ainda não mapeados

A documentação da Uappi possui muitos endpoints. Para permitir evolução incremental sem bloquear o projeto, o SDK expõe um método genérico com os mesmos headers, tratamento de erro e metadados:

const { data, meta } = await uappi.front.request('GET', 'products', {
  query: { offset: 0, limit: 24 },
  next: { revalidate: 60 },
});

Se preferir informar o path completo, também funciona:

await uappi.get('/v2/front/brands');

Tratamento de erros

Respostas HTTP fora da faixa 2xx lançam UappiApiError com status, payload e Request-Id quando retornado pela API.

import { UappiApiError } from '@rodrigoaraujotl/sdk-uappi';

try {
  await uappi.front.checkout.getCart();
} catch (error) {
  if (error instanceof UappiApiError) {
    console.error(error.status, error.requestId, error.payload);
  }
}

Build e validação

npm run typecheck
npm test
npm run build