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/document-reference-repository

v0.0.1

Published

Esta librería Angular proporciona utilidades para gestionar referencias entre documentos en colecciones distintas del backend (por ejemplo, relaciones entre facturas y notas de crédito). Incluye:

Readme

Librería: document-reference-repository

Esta librería Angular proporciona utilidades para gestionar referencias entre documentos en colecciones distintas del backend (por ejemplo, relaciones entre facturas y notas de crédito). Incluye:

  • Un módulo de configuración (CbmDocumentReferenceModule) que expone un token de configuración.
  • Un servicio (CbmDocumentReferenceService) y un repositorio (CbmDocumentReferenceRepository) con métodos HTTP tipados.
  • Tipos TypeScript en el namespace CbmDocumentReferenceModel que describen peticiones y respuestas.

Exportaciones principales

  • CbmDocumentReferenceModule — módulo para configurar la librería con forRoot({ baseUrl }).
  • CbmDocumentReferenceService — servicio con llamadas HTTP; providedIn: 'root'.
  • CbmDocumentReferenceRepository — repositorio que delega en el servicio.
  • CbmDocumentReferenceModel — modelos y tipos.

Instalación

npm install document-reference-repository

Configuración en Angular

Configura la URL base del servicio al importar el módulo en tu AppModule:

import { CbmDocumentReferenceModule } from 'document-reference-repository';

@NgModule({
  imports: [
    CbmDocumentReferenceModule.forRoot({ baseUrl: 'https://api.example.com/document-reference' }),
  ],
})
export class AppModule {}

API pública (resumen)

El servicio y repositorio exponen los siguientes métodos:

  • list(params: ListParams): Observable
  • getOne(id: string): Observable
  • save(data: SaveBody): Observable
  • saveMany(data: SaveManyBody): Observable
  • delete(id: string): Observable
  • relationshipTree(params: RelationshipTreeParams): Observable<RelationshipTreeResponse[]>
  • parentTree(params: ParentTreeParams): Observable<ParentTreeResponse[]>
  • validationBeforeSave(params: ValidationBeforeSaveParams): Observable

Modelos relevantes

  • ListParams / ListResponse — filtros y respuesta de listado.
  • GetOneResponse — detalle de una referencia.
  • SaveBody / SaveManyBody — payloads para crear referencias.
  • RelationshipTreeResponse / ParentTreeResponse — modelos recursivos para árboles de relación.
  • ConfirmResponse — respuesta estándar de confirmación { success: boolean; message: string; data?: any }.

Ejemplo rápido de uso

import { Component, OnInit } from '@angular/core';
import { CbmDocumentReferenceRepository } from 'document-reference-repository';

@Component({ template: '' })
export class ExampleComponent implements OnInit {
  constructor(private repo: CbmDocumentReferenceRepository) {}

  ngOnInit() {
    this.repo.list({ collection_origin_name: 'invoices', start_date: 0 }).subscribe(r => console.log(r.data));
  }
}

Notas y recomendaciones

  • La librería está diseñada para que el baseUrl sea configurable mediante el token DOCUMENT_REFERENCE_MODULE_CONFIG.
  • El servicio utiliza HttpClient internamente; para añadir autenticación o manejo global de errores, registra interceptores en tu aplicación.
  • Usa HttpClientTestingModule y HttpTestingController para testear los métodos y comprobar que las URLs y parámetros se formen correctamente.

Contribuciones

  • Para mejoras o correcciones, abre un PR con los tests necesarios y la documentación del cambio.

Licencia

  • Añade aquí la licencia que aplique a tu proyecto.