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

unnbound-env

v0.0.6

Published

A type-safe environment variable management library with validation support.

Readme

unnbound-env

Type-safe environment SDK for accessing partners, connections, and variables in Unnbound workflows.

Installation

npm install unnbound-env

Usage

import { createServer } from 'unnbound-events';
import { env, selectPartnerFromEvent, createHttpClient } from 'unnbound-env';

const server = createServer();

// Determine partner from URL parameter
server.get(
  '/webhook/:partnerId',
  selectPartnerFromEvent((c) => c.params.partnerId),
  (c) => ({ status: 200, body: {} })
);

// Determine partner from authorization header
server.get(
  '/webhook',
  selectPartnerFromEvent((c) => {
    const apiKey = c.request.headers.authorization;

    if (!apiKey) return;

    return env.partners.search(
      (partner) => partner.variables.get('UNNBOUND_API_KEY') === apiKey
    );
  }),
  async (c) => {
    // Get current partner (set by selectPartnerFromEvent middleware)
    const partner = env.partners.current;

    // Get a specific partner by key
    const specificPartner = env.partners.get('EXTERNAL_PARTNER_ID');

    // Get a global connection
    const globalConnection = env.connections.get('TURVO_OAUTH');

    // Get a partner connection
    const partnerConnection = partner.connections.get('TURVO_OAUTH');

    // Get a global variable
    const globalApiKey = env.variables.get('GITHUB_API_KEY');

    // Get a partner variable
    const partnerApiKey = partner.variables.get('GITHUB_API_KEY');

    // Create an HTTP client with a connection (accepts key or connection object)
    const client = createHttpClient(partner.connections.get('GITHUB_API_KEY'));

    // Standard axios request
    const response = await client.get('/protected/resource');

    return { status: 200, body: {} };
  }
);

API Reference

env

The main environment accessor singleton.

env.partners

  • env.partners.current - Get the current partner (requires selectPartnerFromEvent middleware)
  • env.partners.get(key) - Get a partner by key
  • env.partners.getAll() - Get all partners
  • env.partners.has(key) - Check if a partner exists
  • env.partners.search(predicate) - Search for a partner by predicate

env.connections

  • env.connections.get(key, type?) - Get a global connection by key
  • env.connections.has(key) - Check if a connection exists

env.variables

  • env.variables.get(key) - Get a global variable by key
  • env.variables.has(key) - Check if a variable exists

Partner Accessors

Each partner has its own accessor for connections and variables:

const partner = env.partners.get('PARTNER_KEY');

// Partner connections
partner.connections.get('CONNECTION_KEY');

// Partner variables
partner.variables.get('VARIABLE_KEY');

// Partner attributes
partner.attributes;

selectPartnerFromEvent

Middleware that sets the current partner from the request context.

selectPartnerFromEvent((c) => {
  // Return partner key from request context
  return c.params.partnerId;
});

selectPartner

Utility to execute code in a partner context.

import { selectPartner } from 'unnbound-env';

selectPartner('PARTNER_KEY', (partner) => {
  // Code runs with partner context
  const apiKey = partner.variables.get('API_KEY');
});

createHttpClient

Create an axios-based HTTP client with automatic connection authentication.

import { createHttpClient } from 'unnbound-env';

// With connection key
const client = createHttpClient('GITHUB_CONNECTION');

// With connection object
const client = createHttpClient(partner.connections.get('GITHUB_CONNECTION'));

// With custom axios config
const client = createHttpClient({ timeout: 5000 }, 'GITHUB_CONNECTION');

Supported connection types:

  • basic-auth - Basic authentication
  • bearer-token - Bearer token / API key authentication
  • oauth20 - OAuth 2.0 (client credentials or password grant)
  • request - Custom headers only (no auth)

Connection Types

// Basic Auth
{
  type: 'basic-auth',
  config: {
    url: string,
    headers: { key: string, value: string }[],
    username: string,
    password: string,
  }
}

// Bearer Token
{
  type: 'bearer-token',
  config: {
    url: string,
    headers: { key: string, value: string }[],
    apiKey: string,
    apiKeyPlacement: 'authorization_bearer' | 'custom_header',
    apiKeyHeaderName?: string, // required when placement is 'custom_header'
  }
}

// OAuth 2.0
{
  type: 'oauth20',
  config: {
    url: string,           // token endpoint
    headers: { key: string, value: string }[],
    grantType?: 'client_credentials' | 'password', // defaults to 'client_credentials'
    bodyParams?: { key: string, value: string }[], // extra params merged into token request body
    clientId: string,
    clientSecret: string,
    username?: string,     // required for password flow
    password?: string,     // required for password flow
  }
}

// Request (custom headers, no auth)
{
  type: 'request',
  config: {
    url: string,
    headers: { key: string, value: string }[],
  }
}