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

@karmaniverous/aws-cognito-tools

v0.1.0

Published

X-Ray-enabled AWS Cognito client wrapper and get-dotenv CLI plugin.

Readme

AWS Cognito Tools

Tools and a get-dotenv plugin for working with AWS Cognito User Pools.

This package provides:

  • A tools-style wrapper that owns AWS client setup (including optional AWS X-Ray capture):
    • AwsCognitoTools
  • A get-dotenv plugin intended to be mounted under aws:
    • cognitoPlugin()aws cognito pull|purge
  • A CLI embedding get-dotenv with the cognito plugin:
    • aws-cognito-tools

Documentation

Install

npm i @karmaniverous/aws-cognito-tools

This package is ESM-only (Node >= 22).

Quick start (programmatic)

import { AwsCognitoTools } from '@karmaniverous/aws-cognito-tools';

const tools = new AwsCognitoTools({
  clientConfig: { region: 'us-east-1', logger: console },
  xray: 'auto',
});

// Resolve a User Pool by environment naming convention
const pool = await tools.resolveUserPool({ env: 'dev' });

// List all users with pagination guardrails
const users = await tools.listAllUsers({
  userPoolId: pool.Id!,
  maxResults: 100,
  onPage: (page, num) => console.log(`Page ${num}: ${page.length} users`),
});

// Escape hatch: use the fully configured SDK client directly
import { AdminGetUserCommand } from '@aws-sdk/client-cognito-identity-provider';
const user = await tools.client.send(
  new AdminGetUserCommand({ UserPoolId: pool.Id!, Username: '[email protected]' }),
);

Quick start (smoz plugin)

Mount in your get-dotenv CLI:

import { createCli } from '@karmaniverous/get-dotenv/cli';
import { awsPlugin } from '@karmaniverous/get-dotenv/plugins';
import { cognitoPlugin } from '@karmaniverous/aws-cognito-tools';

await createCli({
  alias: 'smoz',
  compose: (program) =>
    program.use(awsPlugin().use(cognitoPlugin())),
})();

Then use the CLI:

# Pull Cognito pool + client config into local .env files
smoz --env dev aws cognito pull --client-name my-app-client-dev

# Purge all users from a dev pool (DESTRUCTIVE)
smoz --env dev aws cognito purge --force

Quick start (standalone CLI)

aws-cognito-tools --env dev aws cognito pull --client-name my-app-client-dev
aws-cognito-tools --env dev aws cognito purge --force

Notes:

  • --env is a root-level (get-dotenv) option and must appear before the command path.
  • Pool ID and client name support $VAR expansion evaluated at action time against { ...process.env, ...ctx.dotenv }.

Pull command — CognitoMappings

The pull command resolves a User Pool and Client, then writes configured env vars to local dotenv files using JSONPath mappings.

Configure mappings in your get-dotenv config under plugins['aws/cognito']:

{
  "pull": {
    "mappings": {
      "env": {
        "public": {
          "NEXT_PUBLIC_COGNITO_CLIENT_ID": "$.userPoolClient.ClientId",
          "NEXT_PUBLIC_COGNITO_DOMAIN": "$.userPool.Domain",
          "COGNITO_REGION": "$.region",
          "COGNITO_USER_POOL_ID": "$.userPool.Id"
        },
        "private": {
          "COGNITO_CLIENT_SECRET": "$.userPoolClient.ClientSecret"
        }
      }
    }
  }
}

The source object resolved against is:

{ userPool, userPoolClient, region }

AWS X-Ray capture (optional)

X-Ray support is guarded:

  • Default behavior is xray: 'auto': capture is enabled only when AWS_XRAY_DAEMON_ADDRESS is set.
  • To enable capture, install the optional peer dependency: aws-xray-sdk
  • In auto mode, if AWS_XRAY_DAEMON_ADDRESS is set but aws-xray-sdk is not installed, construction throws.

See @karmaniverous/aws-xray-tools for details.


See CHANGELOG for release history.