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/payment-term-repository

v0.0.1

Published

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

Readme

@cbm-common/payment-term-repository

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

Resumen

  • Propósito: Proveer el acceso a la API de condiciones de pago (Payment Term) mediante un servicio HTTP tipado y un repositorio inyectable.
  • Paquete: @cbm-common/payment-term-repository (ver package.json).
  • Requisitos: Angular 20.1.5 y HttpClientModule en la aplicación consumidora.

Qué exporta

  • Exports públicos (ver src/public-api.ts): payment-term.model, payment-term.module, payment-term.repository, payment-term.service.

Configuración del módulo

El módulo CbmPaymentTermModule permite inyectar la baseUrl de la API mediante forRoot:

import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { CbmPaymentTermModule } from '@cbm-common/payment-term-repository';

@NgModule({
   imports: [HttpClientModule, CbmPaymentTermModule.forRoot({ baseUrl: 'https://api.example.com/api/payment-terms' })],
})
export class AppModule {}
  • Interfaz de configuración: ICbmPaymentTermModuleConfig { baseUrl: string }.
  • Token de inyección: PAYMENT_TERM_MODULE_CONFIG.

Servicio: CbmPaymentTermService

El servicio construye rutas a partir de config.baseUrl y expone métodos para consultar la API:

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

    • Parámetros: { name?: string; code?: string }
    • Endpoint: GET ${baseUrl}
  • getOne(id: string): Observable<CbmPaymentTermModel.GetOneResponse>

    • Endpoint: GET ${baseUrl}/{id}

Modelos y contratos (CbmPaymentTermModel)

  • ListParams: filtros opcionales (name, code).
  • ListResponse: { success: boolean; data: Array< { _id, country_id, code, name, SRI_code, created_at, created_user, order? } > }
  • GetOneResponse: { success: boolean; data: { _id, country_id?, code?, name?, created_at?, created_user?, SRI_code?, order? } }

Repositorio: CbmPaymentTermRepository

  • Interfaz ICbmPaymentTermRepository que expone list(params) y getOne(id) y delega en CbmPaymentTermService.

Ejemplo de uso en un componente

import { Component, OnInit } from '@angular/core';
import { CbmPaymentTermRepository } from '@cbm-common/payment-term-repository';

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

   ngOnInit() {
      this.repo.list({ name: 'Net' }).subscribe(res => console.log(res.data));
   }
}

Build y publicación

Para compilar la librería desde la raíz del workspace:

ng build payment-term-repository

Los artefactos estarán en dist/payment-term-repository. Para publicar:

cd dist/payment-term-repository
npm publish

Notas y recomendaciones

  • El módulo se diseñó para inyectar la URL base mediante PAYMENT_TERM_MODULE_CONFIG; asegúrate de registrar CbmPaymentTermModule.forRoot({ baseUrl }) en la app consumidora.
  • El servicio usa HttpClient y construye rutas con config.baseUrl. Si necesitas interceptores o un adaptador HTTP específico (antes se usaba PaymentTermHttpService en alguna versiones), considera añadir un adaptador o registrar interceptores a nivel de la app consumidora.
  • Los tipos están definidos en src/lib/payment-term.model.ts y se usan en el repositorio y el servicio; no se usa any en las firmas públicas.

Siguientes pasos sugeridos

  • Añadir ejemplos de tests unitarios que mockeen HttpClient para CbmPaymentTermService.
  • Documentar en el README un ejemplo de configuración de interceptores si la API requiere autenticación específica.

Estado: README.md actualizado con documentación en español basada en los archivos fuente de la librería.