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

fastpii-connect

v0.3.1

Published

Client SDK for the FastPII AI Data Security Platform — detect and protect sensitive data before it reaches AI systems

Readme

FastPII Connect — TypeScript SDK

Client SDK for the FastPII AI Data Security Platform.

FastPII detects and protects sensitive information before it reaches AI systems, enabling organisations to use AI securely while meeting privacy and governance requirements.

Installation

npm install fastpii-connect
# or
pnpm add fastpii-connect
# or
yarn add fastpii-connect

Requires Node.js 18+.

Quick Start

import { FastPIIClient } from "fastpii-connect";

const client = new FastPIIClient({ apiKey: "fpk_your_api_key" });

// Detect PII
const result = await client.detect("My rodné číslo is 900101/1234");
for (const entity of result.entities) {
  console.log(`Found ${entity.type}: ${entity.original}`);
}

// Protect PII
const protected = await client.protect("My rodné číslo is 900101/1234", { mode: "replace" });
console.log(protected.protected_text);

// Validate an identifier
const valid = await client.validate("900101/1234", { entity_type: "rodne_cislo" });
console.log(`Valid: ${valid.valid}`);

// List available detectors
const detectors = await client.listDetectors({ country: "CZ" });
for (const d of detectors.detectors) {
  console.log(`${d.name}: ${d.description}`);
}

Async/Await

All methods return Promises. Use async/await or .then():

const client = new FastPIIClient({ apiKey: "fpk_your_api_key" });

// async/await
const result = await client.detect("Hello world");

// Promise chain
client.detect("Hello world").then((result) => {
  console.log(result.entities);
});

Session Management

import { Session, FastPIIClient } from "fastpii-connect";

const client = new FastPIIClient({ apiKey: "fpk_your_api_key" });
const session = new Session(client);

const r1 = await session.detect("My rodné číslo is 900101/1234");
console.log(session.countries); // ["CZE"]

const r2 = await session.detect("My PESEL is 90010112345");
console.log(session.countries); // ["CZE", "POL"]
console.log(session.messageCount); // 2

Gateway (AI Chat Completions)

// Non-streaming
const response = await client.gateway.chat.completions({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);

// Streaming
for await (const event of client.gateway.chat.stream({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
})) {
  if ("content" in event) {
    process.stdout.write(event.content);
  }
}

Error Handling

import {
  FastPIIError,
  AuthenticationError,
  RateLimitError,
  QuotaExceededError,
  ValidationError,
} from "fastpii-connect";

try {
  const result = await client.detect("text");
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.log("Invalid API key");
  } else if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
  } else if (error instanceof QuotaExceededError) {
    console.log("Monthly quota exceeded");
  } else if (error instanceof FastPIIError) {
    console.log(`FastPII error: ${error.message}`);
  }
}

Configuration

const client = new FastPIIClient({
  apiKey: "fpk_your_api_key", // or set FASTPII_API_KEY env var
  baseUrl: "https://api.fastpii.com", // default
  timeout: 30, // request timeout in seconds
  maxRetries: 2, // retries for 408, 429, 502, 503, 504
});

Protection Modes

| Mode | Description | Example | |---|---|---| | replace | Replace with [REDACTED] | My email is [REDACTED] | | mask | Replace with * characters | My email is ************ | | hash | Replace with SHA-256 hash | My email is a5dc0ea20c... | | tokenize | Replace with reversible token | My email is a5dc0ea20c... |

Environment Variables

| Variable | Description | |---|---| | FASTPII_API_KEY | API key (used if apiKey not provided) | | FASTPII_BASE_URL | Base URL override (used if baseUrl not provided) |

License

MIT — see LICENSE file.