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

@cbm-common/tax-ice-repository

v0.0.1

Published

Documentación en español para la librería `@cbm-common/tax-ice-repository`.

Downloads

9

Readme

@cbm-common/tax-ice-repository

Documentación en español para la librería @cbm-common/tax-ice-repository.

Resumen

  • Propósito: Proveer una capa de acceso (repository + service) para gestionar los datos de ICE/Impuestos especiales (Tax ICE) vía HTTP.
  • Paquete: @cbm-common/tax-ice-repository (ver package.json).
  • Requisitos: @angular/core y @angular/common v20.1.5 y HttpClientModule disponible en la app.

Estado del contenido del paquete

  • Exports públicos: src/public-api.ts expone index, tax-ice.model, tax-ice.module, tax-ice.repository, tax-ice.service.

Instalación

  1. Instalar la librería desde el registro NPM (asumiendo que está publicada):
npm install @cbm-common/tax-ice-repository
  1. La librería requiere HttpClientModule en la aplicación que la consume:
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';

@NgModule({
   imports: [HttpClientModule],
})
export class AppModule {}

Uso rápido

  1. Registrar el módulo con configuración base (URL base del API):
import { NgModule } from '@angular/core';
import { CbmTaxIceModule } from '@cbm-common/tax-ice-repository';

@NgModule({
   imports: [
      CbmTaxIceModule.forRoot({ baseUrl: 'https://api.example.com/api/tax-ices' }),
   ],
})
export class AppModule {}
  1. Inyectar el repositorio y usar sus métodos (retornan Observable):
import { Component, OnInit } from '@angular/core';
import { CbmTaxIceRepository } from '@cbm-common/tax-ice-repository';

@Component({ selector: 'app-demo', template: '' })
export class DemoComponent implements OnInit {
   constructor(private repo: CbmTaxIceRepository) {}

   ngOnInit() {
      // List
      this.repo.list({ enabled: true }).subscribe(res => console.log(res.data));

      // Get one
      this.repo.getOne('id-123').subscribe(res => console.log(res.data));

      // Save
      this.repo.save({ code: 'ICE001', type: 'fixed', value: 10 }).subscribe(r => console.log(r.message));
   }
}

API pública (resumen)

Módulos / símbolos principales exportados (ver src/lib):

  • CbmTaxIceModule — módulo para configurar la URL base mediante forRoot({ baseUrl }).
  • CbmTaxIceService — servicio que realiza las llamadas HTTP.
  • CbmTaxIceRepository — repositorio inyectable que delega en el servicio y expone la API usada por la aplicación.
  • CbmTaxIceModel — tipos/contratos para parámetros y respuestas.

Modelos principales (CbmTaxIceModel)

  • ListParams: { enabled?: boolean; description?: string }
  • ListResponse: { success: boolean; data: Array<{ _id, code, value, percentage, description, type, start_range, end_range, ice_vehicle, enabled, ... }> }
  • GetOneResponse: { success: boolean; data: { _id, code?, percentage?, description?, ... } }
  • SaveBody: { code: string; value?: number; percentage?: number; description?: string; type: string; start_range?: number; end_range?: number; ice_vehicle?: boolean }
  • UpdateBody: similar a SaveBody pero opcional en sus campos
  • ChangeStatusBody: { enabled: boolean; disabled_reason?: string }
  • ConfirmResponse: { success: boolean; message: string; data?: any }

Métodos disponibles en CbmTaxIceRepository (firma y comportamiento)

  • list(params: CbmTaxIceModel.ListParams): Observable<CbmTaxIceModel.ListResponse>

    • Consulta la lista filtrada por params.
  • getOne(id: string): Observable<CbmTaxIceModel.GetOneResponse>

    • Obtiene un registro por su id.
  • save(data: CbmTaxIceModel.SaveBody): Observable<CbmTaxIceModel.ConfirmResponse>

    • Crea un nuevo registro.
  • update(id: string, data: CbmTaxIceModel.UpdateBody): Observable<CbmTaxIceModel.ConfirmResponse>

    • Actualiza el registro identificado por id.
  • changeStatus(id: string, data: CbmTaxIceModel.ChangeStatusBody): Observable<CbmTaxIceModel.ConfirmResponse>

    • Cambia el estado enabled de un registro y puede incluir disabled_reason.
  • delete(id: string): Observable<CbmTaxIceModel.ConfirmResponse>

    • Elimina el registro.

Comportamiento del servicio HTTP (CbmTaxIceService)

  • Construye rutas a partir de config.baseUrl (se limpia de slashes finales).
  • Endpoints usados (por convención del servicio):
    • GET ${baseUrl} -> list
    • GET ${baseUrl}/{id} -> getOne
    • POST ${baseUrl} -> save
    • PUT ${baseUrl}/{id} -> update
    • PUT ${baseUrl}/change-status/{id} -> changeStatus
    • DELETE ${baseUrl}/{id} -> delete

Ejemplos de payloads

  • SaveBody ejemplo:
{
   "code": "ICE001",
   "type": "fixed",
   "value": 12.5,
   "description": "Impuesto especial ejemplo",
   "ice_vehicle": false
}
  • ChangeStatusBody ejemplo:
{
   "enabled": false,
   "disabled_reason": "Obsoleto"
}

Build y publicación

Para compilar la librería (desde el workspace raíz):

ng build tax-ice-repository

Los artefactos estarán en dist/tax-ice-repository. Para publicar (si corresponde):

cd dist/tax-ice-repository
npm publish

Tests

  • Ejecutar tests unitarios del workspace con ng test (si están configurados en el proyecto consumidor).

Notas de implementación y contexto (resumen de archivos revisados)

  • package.json: nombre del paquete y peerDependencies (Angular 20.1.5).
  • src/public-api.ts: exporta ./lib/index.
  • src/lib/index.ts: re-exporta tax-ice.model, tax-ice.module, tax-ice.repository, tax-ice.service.
  • src/lib/tax-ice.module.ts: expone CbmTaxIceModule.forRoot({ baseUrl }) que inyecta TAX_ICE_MODULE_CONFIG.
  • src/lib/tax-ice.service.ts: implementa las llamadas HTTP descritas arriba.
  • src/lib/tax-ice.repository.ts: reexpone los métodos del servicio con contratos de CbmTaxIceModel.

Asunciones

  • La API remota respeta las rutas y respuestas esperadas por CbmTaxIceService (estructura JSON y códigos HTTP habituales).

Siguientes pasos sugeridos (opcionales)

  • Añadir ejemplos de pruebas unitarias para CbmTaxIceRepository y CbmTaxIceService.
  • Documentar posibles códigos de error HTTP y mapeo a errores de cliente.

Estado: README actualizado con documentación en español y ejemplos.