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

pcm-library-base

v21.0.8

Published

Base compartida de los proyectos web de PCM (Plataforma de Mesa de Servicios): configuración de runtime, sesión, términos multi-idioma, alertas, spinner, interceptores HTTP y validación de inputs.

Readme

pcm-library-base

Base compartida de los proyectos web de PCM (Plataforma de Mesa de Servicios): configuración de runtime, sesión, términos multi-idioma, alertas, spinner, interceptores HTTP y validación de inputs.

  • Angular 21 · PrimeNG 21 · componentes standalone.
  • Los estilos no viven aquí: los aporta el design system PCM.Style.Guide (@PCM/style-guide-*).

Instalación

pnpm add pcm-library-base

Peer dependencies: @angular/common y @angular/core ^21.2, primeng ^21, rxjs ~7.8.

Configuración en la app

// app.config.ts (o main.single-spa.ts en un microfront)
import { ConfigService, ErrorInterceptor, InitializeConfigService, ResponseHeadersInterceptor } from "pcm-library-base";
import { ConfirmationService, MessageService } from "primeng/api";

providers: [
	provideAppInitializer(() => InitializeConfigService(inject(ConfigService))()),
	provideHttpClient(withFetch(), withInterceptors([ErrorInterceptor, ResponseHeadersInterceptor])),
	MessageService,
	ConfirmationService,
];

ConfigService carga /environment/environment.json (interfaz PcmEnvironment) antes de arrancar y, si hay cookie de token, la información de sesión (sessionInformation).

API

| Pieza | Tipo | Uso | | --- | --- | --- | | ConfigService | servicio | environment (runtime) y sessionInformation. InitializeConfigService para provideAppInitializer. | | GlobalTermService | servicio | Términos por pageRoot: initialize(pageRoot), setLanguage(code), getPageRoot(), languageCode, termsReady (signal). Si el ambiente no define securityPath, no consulta y marca termsReady de inmediato. | | TermPipe | pipe term | {{ 'TermName' \| term: globalTermService.languageCode }}. Con parámetros: \| term: globalTermService.languageCode : ['Ana'] (reemplaza {0}, {1}…). Si el término no existe devuelve "-". | | TermHttpService | servicio http | getTerms(languageCode, pageRoot) (lo usa GlobalTermService). | | AlertService | servicio | success, info, warning, error, show(type, summary, detail) sobre el MessageService de PrimeNG, con la key PcmToastKey. | | SpinnerService / SpinnerComponent | servicio / componente <pcm-spinner /> | show(), hide(), isLoading (signal). | | CloseSessionService | servicio | closeSession(): limpia sessionStorage, borra las cookies salvo language (COOKIES_KEPT_ON_CLOSE, para que el login conserve el idioma) y redirige a environment.authenticationWeb. | | ErrorInterceptor | interceptor | Agrega headers (Authorization, RefreshToken, ClientID, Environment, PageRoot, LanguageCode) y maneja 401/403/errores con alertas. Se omite con el header SkipInterceptorHeader. | | ResponseHeadersInterceptor | interceptor | Solo en localhost: guarda en la cookie token el token renovado que el backend devuelve en el header TokenNew. | | Patterns | clase | Patrones de [pattern]: PatternText, PatternEmail, PatternOnlyLetters, PatternOnlyLettersWithAccents, PatternLettersEmail. | | DynamicInputValidation | función | (keypress)="DynamicInputValidation($event, Patterns.PatternLettersEmail)": bloquea caracteres fuera del patrón (deja pasar Enter, Tab y atajos). Usar patrones de un carácter (no PatternEmail, que valida el valor completo). | | PcmToastKey | constante | Key del toast global: <p-toast class="prToast" [key]="pcmToastKey" position="bottom-right" />. AlertService envía siempre con esta key. | | PcmCookies, GetCookieAttributes | constantes / función | Nombres y atributos de las cookies de sesión e idioma. | | AlertType | enum | Success, Info, Warning, Error. | | PcmEnvironment, SessionInformation, TermPageResponse | interfaces | DTOs. SessionInformation = respuesta de api-authentication/ignore/session-information: businessUserID, userName, fullName, email, roleCode, roleName, level (null sin nivel), isAdmin, forcePasswordChange. |

Validación de inputs (estándar)

import { DynamicInputValidation, Patterns } from "pcm-library-base";

export class UseCase {
	public readonly patterns = new Patterns();
	public dynamicInputValidation(event: KeyboardEvent, pattern: string): void {
		DynamicInputValidation(event, pattern);
	}
}
<input pInputText class="prInputtext" type="email" name="email" required
	[pattern]="patterns.PatternEmail"
	(keypress)="dynamicInputValidation($event, patterns.PatternLettersEmail)"
	[(ngModel)]="useCaseDomain.email" />

Desarrollo y publicación

Desde PCMLibraryComponents/:

pnpm install
pnpm run build:base      # → dist/pcm-library-base

La publicación en npm es automática: el workflow .github/workflows/publish-pcm-library-base.yml se ejecuta al hacer push a main con cambios en projects/pcm-library-base/** (o a mano desde Actions → Publish pcm-library-base → Run workflow). Publica la versión 21.0.<número de ejecución> con Trusted Publishing (OIDC de GitHub Actions), sin tokens.

Publicación manual (solo si hace falta): npm login con la cuenta de PCM y pnpm run publish:base (pide el código 2FA).