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

@tollverainc/operator-sdk

v0.1.0

Published

Tollvera operator SDK — charge drivers via license plate from parking garages, toll roads, EV chargers, and fuel stations.

Downloads

416

Readme

@tollvera/operator-sdk

The official SDK for Tollvera operators (parking garages, toll roads, EV chargers, fuel stations). Charge drivers automatically via license plate.

Install

npm install @tollvera/operator-sdk
# or
pnpm add @tollvera/operator-sdk

Quick start

import { Tollvera } from '@tollvera/operator-sdk';

const tollvera = new Tollvera({
  apiKey: process.env.TOLLVERA_API_KEY!, // keep server-side!
});

// Called by your ALPR camera / toll gantry when a plate is detected
async function onPlateDetected(plate: string) {
  try {
    const result = await tollvera.charge({
      plate,
      country: 'US',
      amountCents: 500,
      currency: 'USD',
      kind: 'parking',
      locationName: 'Downtown Garage - Level 2',
      operatorReference: `session-${Date.now()}`, // YOUR unique id
    });

    if (result.status === 'captured') {
      console.log(`Charged $5 — ${result.transactionId}`);
      openGate();
    }
  } catch (err) {
    if (err instanceof TollveraError && err.isDriverError) {
      // 402 → no payment method on file, or exceeded cap
      // 404 → plate not registered with Tollvera
      // → fall back to kiosk payment
      showKioskUI();
    } else {
      // 5xx → Tollvera is down. SDK already retried 3x.
      // → open the gate (safer than blocking a line of cars)
      logAndOpenGate();
    }
  }
}

API

new Tollvera(config)

interface TollveraConfig {
  apiKey: string;              // required
  baseUrl?: string;            // default: https://api.tollvera.com
  timeout?: number;            // default: 10000 ms
  maxRetries?: number;         // default: 2 (3 total attempts)
}

tollvera.charge(request)

interface ChargeRequest {
  plate: string;               // "ABC-1234" (will be normalized server-side)
  country: 'US' | 'RO' | 'DE' | 'FR' | 'GB' | 'IT' | 'ES' | 'NL' | ...;
  amountCents: number;         // 500 = $5.00
  currency: 'USD' | 'EUR' | 'RON' | 'GBP';
  kind: 'parking' | 'toll' | 'ev_charging' | 'fuel';
  locationName: string;        // Shown to driver in receipt
  locationLat?: number;
  locationLon?: number;
  operatorReference: string;   // YOUR unique ID — enables idempotency
  occurredAt?: string;         // ISO 8601, default: now
}

interface ChargeResult {
  transactionId: string;
  status: 'captured' | 'failed' | 'pending';
  authorizedAt: string | null;
  idempotentReplay?: boolean;  // true if same reference seen before
}

tollvera.health()

Health check — pings the backend. Returns { status, service, version }. Use for monitoring.

Idempotency

Every charge() call requires an operatorReference that's unique within YOUR operator account. If the same reference is sent twice:

  • The driver is not charged twice
  • Both calls return the same transactionId
  • The second call has idempotentReplay: true

This means it's safe to retry on timeouts, network errors, or app crashes.

Example — use the parking session ID:

operatorReference: `parkomobility-session-${sessionId}`

Error handling

The SDK throws TollveraError with helpful flags:

import { TollveraError } from '@tollvera/operator-sdk';

try {
  await tollvera.charge(req);
} catch (err) {
  if (err instanceof TollveraError) {
    console.log(err.code);           // 'no_vehicle', 'cap_exceeded', 'card_declined', ...
    console.log(err.message);        // human-readable
    console.log(err.status);         // HTTP status
    console.log(err.requestId);      // for support tickets

    if (err.isDriverError)   { /* 402/404 — plate not registered or no card */ }
    if (err.isServerError)   { /* 5xx — Tollvera outage, we retried */ }
    if (err.isClientError)   { /* 4xx — your request was wrong */ }
  }
}

Transport

  • Uses native fetch (Node 18+, Deno, Bun, Cloudflare Workers, browsers)
  • Zero runtime dependencies
  • Retries 5xx with exponential backoff (100ms → 400ms → 900ms)
  • Respects AbortController for timeouts
  • Automatic User-Agent: tollvera-operator-sdk/0.1.0

Platform compatibility

| Runtime | Supported | |---|---| | Node.js 18+ | ✅ | | Deno 1.28+ | ✅ | | Bun | ✅ | | Cloudflare Workers | ✅ | | Browsers | ⚠️ Don't — the API key must stay server-side | | React Native | ⚠️ Same reason |

Development

pnpm install
pnpm build       # creates dist/ with CJS + ESM + .d.ts
pnpm test        # runs vitest
pnpm typecheck

License

MIT © Tollvera