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

@codice-arg/http-service

v1.0.6

Published

Este paquete proporciona una clase base abstracta para manejar solicitudes HTTP con manejo integrado de tokens de acceso y tokens de actualización. Está diseñado para ser extendido por servicios específicos que requieren autenticación y manejo automático

Downloads

30

Readme

@http-service

Este paquete proporciona una clase base abstracta para manejar solicitudes HTTP con manejo integrado de tokens de acceso y tokens de actualización. Está diseñado para ser extendido por servicios específicos que requieren autenticación y manejo automático de renovación de tokens.

Características

  • Configuración de Axios con baseURL predefinida.
  • Intercepción de solicitudes para inyectar automáticamente el token de acceso.
  • Intercepción de respuestas para manejar errores de autenticación y renovar tokens de acceso automáticamente.
  • Métodos abstractos para cargar, guardar y refrescar tokens, permitiendo implementaciones personalizadas de manejo de tokens.

Instalación

Para instalar este paquete, usa el siguiente comando:

npm install @codice-arg/http-service

Uso Básico

Primero, debes crear una clase concreta que extienda HttpBase y proporcione implementaciones para los métodos abstractos relacionados con el manejo de tokens:

import { HttpBase } from "@codice-arg/http-service";

class MiHttpService extends HttpBase {
  constructor() {
    super("https://api.miservicio.com");
  }

  async getAccessToken() {
    // Implementación para cargar el access token
  }

  async saveAccessToken(accessToken: string | null) {
    // Implementación para guardar el access token
  }

  async refreshAccessToken(refreshToken: string) {
    // Implementación para refrescar el access token
  }

  async getRefreshToken() {
    // Opcional: Implementación para cargar el refresh token
  }

  async saveRefreshToken(refresh: string | null) {
    // Opcional: Implementación para guardar el access token
  }

  protected onUnauthorized() {
    // Opcional: Manejo de casos cuando se agotan los intentos de refresco de token
  }
}