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

@pipeline-builder/api-core

v3.3.30

Published

Core server-side utilities (auth middleware, response helpers, error codes, quota service, HTTP client, logging, AI provider catalog) shared by every Pipeline Builder backend service.

Downloads

11,834

Readme

@pipeline-builder/api-core

📖 View documentation

Core server-side utilities shared by every backend service in Pipeline Builder: JWT authentication middleware, structured logging, response helpers, error codes, quota enforcement, parameter parsing, validation schemas, an internal HTTP client, and the AI provider catalog.

Key Exports

Authentication Middleware

  • requireAuth — JWT authentication middleware (also accepts RequireAuthOptions for allowOrgHeaderOverride on internal-service routes)
  • requireAdmin, requireSystemAdmin — role gates (admin/owner; system-org admin/owner)
  • requireFeature — feature-flag gate
  • isSystemOrg, isSystemAdmin, isServicePrincipal — authorization checks (last one is true when req.user.sub starts with service:)
  • resolveAccessModifier(req, requested) — coerces requested='public' to 'private' unless caller is admin/owner

Service-to-Service Tokens

  • signServiceToken({ serviceName, orgId?, orgName?, ttlSeconds? }) — mints a short-lived JWT identifying the calling service. Default TTL 5 minutes.
  • getServiceAuthHeader(opts) — convenience wrapper returning Bearer <token> for direct use in fetch/axios headers.

Tokens satisfy the standard requireAuth middleware unmodified (sub: service:<name>, role: owner, type: access). Use for inter-service HTTP calls (billing → message renewals, platform → billing on register, etc.).

Request/Response Utilities

  • sendSuccess, sendError, sendBadRequest, sendInternalError, sendPaginated, sendPaginatedNested
  • extractDbError — Extract database error details
  • ErrorCode, getStatusForErrorCode — Standard error codes

Parameter Parsing

  • getParam, getRequiredParam, getParams, getOrgId, getAuthHeader
  • parseQueryBoolean, parseQueryInt, parseQueryString

Validation Schemas (Zod)

  • AIGenerateBodySchema — Validates AI generation requests (prompt, provider, model)
  • AIGenerateFromUrlBodySchema — Validates Git URL generation requests (gitUrl, provider, model, apiKey?, repoToken?)

Internal HTTP Client

  • InternalHttpClient, createSafeClient — Service-to-service HTTP communication
  • ServiceConfig, RequestOptions, HttpResponse — Client types

AI Provider Constants

  • AI_PROVIDER_CATALOG — Static provider/model catalog
  • AI_PROVIDER_ENV_VARS — Provider-to-env-var mapping
  • getAIProviderModels — Get models for a provider

Logging

  • createLogger — Winston logger factory

Quota Service

  • QuotaService (type), createQuotaService — Quota enforcement client
  • QuotaType'plugins' | 'pipelines' | 'apiCalls' | 'aiCalls'
  • QuotaCheckResult, QuotaTier, QUOTA_TIERS, getTierLimits — Quota domain types and tier presets

Health Endpoints

  • createHealthRouter({ serviceName, version?, checkDependencies? }) — registers GET /health (liveness; always 200 unless process is dead) and GET /ready (readiness; 503 when any dependency is 'disconnected'). Use as Kubernetes/ECS liveness + readiness probes respectively.

License

Apache-2.0. See LICENSE.