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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cbm-common/tax-iva-repository

v0.0.1

Published

Documentación en español para la librería `tax-iva-repository`.

Readme

TaxIvaRepository

Documentación en español para la librería tax-iva-repository.

Descripción

tax-iva-repository es una librería Angular que expone un repositorio y un servicio para gestionar impuestos IVA desde una API remota. Provee tipos TypeScript (CbmTaxIvaModel) para las peticiones y respuestas y un módulo que acepta configuración mínima (URL base).

Contenido principal

  • CbmTaxIvaModule — módulo que expone forRoot(config) para inyectar la baseUrl mediante el token TAX_IVA_MODULE_CONFIG.
  • CbmTaxIvaService — servicio providedIn: 'root' que realiza las llamadas HTTP principales (list, getOne, save, update, changeStatus, delete).
  • CbmTaxIvaRepository — implementación inyectable que delega en CbmTaxIvaService; es la interfaz recomendada para consumir desde la aplicación.
  • CbmTaxIvaModel — namespace con los tipos (ListParams, ListResponse, GetOneResponse, SaveBody, UpdateBody, ChangeStatusBody, ConfirmResponse).

Instalación y build

Para compilar la librería dentro del monorepo:

ng build tax-iva-repository

Publicación

Tras compilar, los artefactos estarán en dist/tax-iva-repository y se pueden publicar con npm publish si procede.

Configuración del módulo

El módulo expone un forRoot que devuelve un Provider con el token TAX_IVA_MODULE_CONFIG. Debes registrar la librería en el AppModule de la aplicación consumidora y pasar la baseUrl de la API:

import { CbmTaxIvaModule } from 'tax-iva-repository';

@NgModule({
   imports: [
      CbmTaxIvaModule.forRoot({ baseUrl: 'https://api.ejemplo.com/tax-iva' }),
   ],
})
export class AppModule {}

Uso recomendado (repositorio)

La librería exporta CbmTaxIvaRepository que implementa la interfaz pública para consumir las operaciones. Ejemplo básico en un componente:

import { Component, OnInit } from '@angular/core';
import { CbmTaxIvaRepository, CbmTaxIvaModel } from 'tax-iva-repository';

@Component({ /* ... */ })
export class ExampleComponent implements OnInit {
   constructor(private readonly repo: CbmTaxIvaRepository) {}

   ngOnInit() {
      this.repo.list({ enabled: true }).subscribe(resp => {
         if (resp.success) {
            console.log(resp.data);
         }
      });
   }
}

API pública (resumen de métodos)

  • CbmTaxIvaRepository.list(params: CbmTaxIvaModel.ListParams): Observable<CbmTaxIvaModel.ListResponse>
  • CbmTaxIvaRepository.getOne(id: string): Observable<CbmTaxIvaModel.GetOneResponse>
  • CbmTaxIvaRepository.save(data: CbmTaxIvaModel.SaveBody): Observable<CbmTaxIvaModel.ConfirmResponse>
  • CbmTaxIvaRepository.update(id: string, data: CbmTaxIvaModel.UpdateBody): Observable<CbmTaxIvaModel.ConfirmResponse>
  • CbmTaxIvaRepository.changeStatus(id: string, data: CbmTaxIvaModel.ChangeStatusBody): Observable<CbmTaxIvaModel.ConfirmResponse>
  • CbmTaxIvaRepository.delete(id: string): Observable<CbmTaxIvaModel.ConfirmResponse>

Modelos y tipos

Resumen de los tipos más importantes (ver tax-iva.model.ts para todos los detalles):

  • CbmTaxIvaModel.ListParams: { enabled?: boolean; description?: string }
  • CbmTaxIvaModel.ListResponse: { success: boolean; data: Array<{ _id: string; code?: string; percentage?: number; description?: string; enabled?: boolean; ... }> }
  • CbmTaxIvaModel.GetOneResponse: objeto con success y data con los campos del impuesto.
  • CbmTaxIvaModel.SaveBody: { code: string; percentage: number; description: string }
  • CbmTaxIvaModel.UpdateBody: { code?: string; percentage?: number; description?: string }
  • CbmTaxIvaModel.ChangeStatusBody: { enabled: boolean; disabled_reason?: string }
  • CbmTaxIvaModel.ConfirmResponse: { success: boolean; message: string; data?: any }

Notas de integración y recomendaciones

  • Interceptores y autenticación: la versión actual del módulo sigue el patrón simplificado (el forRoot devuelve un Provider con la baseUrl). Si tu aplicación necesita interceptores (auth, logging), añádelos en la aplicación consumidora o solicita que reintroduzca un HttpService con interceptores dentro de la librería.
  • Manejo de errores: el repositorio devuelve directamente los Observables del servicio. Se recomienda manejar errores con operadores RxJS (catchError, retry) en el consumidor o extender el servicio si se desea un comportamiento centralizado.
  • Tipos: usa los tipos exportados (CbmTaxIvaModel) para evitar any en el código que consume la librería.

Desarrollo y pruebas

  • Ejecutar tests unitarios del workspace:
ng test
  • Para probar la librería localmente desde una app: compila y usa la salida en dist/ o integrala en el monorepo de la app consumidora.

Contacto y mantenimiento

Para cambios, issues o nuevas características, abre un issue o PR en el repositorio del monorepo con pruebas y documentación.

Licencia

Aplica la licencia del monorepo.

Fin de la documentación.