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

@frank-auth/client

v0.2.9

Published

TypeScript client for Frank Authentication API

Downloads

109

Readme

Frank Auth TypeScript Client

Official TypeScript client for the Frank Authentication API. Uses native fetch API for HTTP requests.

Installation

npm install @frank-auth/client

Usage

import { Configuration, AuthApi, UsersApi } from '@frank-auth/client';

// Configure the client
const config = new Configuration({
  basePath: 'https://api.frankauth.com/v1',
  apiKey: 'your-api-key',
  // or use Bearer token
  // accessToken: 'your-access-token',
});

// Create API instances
const authApi = new AuthApi(config);
const usersApi = new UsersApi(config);

// Example: Login
try {
  const response = await authApi.login({
    loginRequest: {
      email: '[email protected]',
      password: 'password123'
    }
  });
  console.log('Login successful:', response);
} catch (error) {
  console.error('Login failed:', error);
}

// Example: Get user profile
try {
  const profile = await usersApi.getCurrentUser();
  console.log('User profile:', profile);
} catch (error) {
  console.error('Failed to get user profile:', error);
}

Advanced Configuration

import { Configuration, AuthApi } from '@frank-auth/client';

const config = new Configuration({
  basePath: 'https://api.frankauth.com/v1',
  apiKey: 'your-api-key',
  fetchApi: fetch, // Use custom fetch implementation if needed
  middleware: [
    {
      pre: async (context) => {
        // Custom request middleware
        console.log('Making request to:', context.url);
        return Promise.resolve(context);
      },
      post: async (context) => {
        // Custom response middleware
        console.log('Response status:', context.response.status);
        return Promise.resolve(context.response);
      }
    }
  ]
});

const authApi = new AuthApi(config);

API Reference

This client provides full access to the Frank Authentication API. See the API documentation for detailed information about available endpoints and operations.

Error Handling

The client uses the native fetch API for HTTP requests. All API methods return promises that resolve to the response data or reject with an error.

try {
  const result = await authApi.login({
    loginRequest: {
      email: '[email protected]',
      password: 'password123'
    }
  });
  // Handle success
  console.log('Login successful:', result);
} catch (error) {
  if (error instanceof Response) {
    // HTTP error response
    console.error('HTTP Error:', error.status, error.statusText);
    const errorBody = await error.text();
    console.error('Error body:', errorBody);
  } else {
    // Network error or other issue
    console.error('Network/Other error:', error.message);
  }
}

Configuration Options

  • basePath: API base URL (default: 'https://api.frankauth.com/v1')
  • apiKey: API key for authentication
  • accessToken: Bearer token for authentication
  • username: Username for basic auth
  • password: Password for basic auth
  • fetchApi: Custom fetch implementation (defaults to global fetch)
  • middleware: Array of middleware for request/response processing

Browser Compatibility

This client uses the native fetch API, which is supported in:

  • Chrome 42+
  • Firefox 39+
  • Safari 10.1+
  • Edge 14+

For older browsers, you may need to include a fetch polyfill:

npm install whatwg-fetch
import 'whatwg-fetch';
import { Configuration, AuthApi } from '@frank-auth/client';

Development

# Install dependencies
npm install

# Build the client
npm run build

# Run tests
npm test

# Lint code
npm run lint

Project Structure

typescript/
├── src/           # Generated TypeScript source files
│   ├── apis/      # API endpoint classes
│   ├── models/    # Type definitions and models
│   └── runtime.ts # Runtime utilities
├── dist/          # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md

TypeScript Support

This client is written in TypeScript and provides full type safety:

import { User, Organization, LoginRequest } from '@frank-auth/client';

// All types are automatically inferred
const loginRequest: LoginRequest = {
  email: '[email protected]',
  password: 'password123'
};

// Response types are strongly typed
const user: User = await usersApi.getCurrentUser();
const org: Organization = await orgApi.getOrganization({ orgId: user.organizationId });