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

@svene/juanfi-api

v0.1.1

Published

[![npm version](https://img.shields.io/npm/v/@svene/juanfi-api.svg)](https://www.npmjs.com/package/@svene/juanfi-api) [![npm downloads](https://img.shields.io/npm/dm/@svene/juanfi-api.svg)](https://www.npmjs.com/package/@svene/juanfi-api)

Readme

@svene/juanfi-api

npm version npm downloads

Typed client for JuanFI vendo endpoints.

Use this when you need to call the vendo directly from a custom app, server script, test harness, or hotspot page code.

install

npm install @svene/juanfi-api

quickstart

import { createJuanFiApi } from '@svene/juanfi-api';

const api = createJuanFiApi({
  vendoIp: '10.1.0.41',
});

const result = await api.startTopup({
  voucher: '',
  mac: 'AA:BB:CC:DD:EE:FF',
  extendTime: false,
});

if (!result.ok) {
  console.log(result.code);
  return;
}

console.log(result.data.voucher);

options

type JuanFiApiOptions = {
  readonly vendoIp: string;
  readonly fetch?: typeof fetch;
  readonly timeoutMs?: number;
};

vendoIp may include a protocol or omit it.

createJuanFiApi({ vendoIp: '10.1.0.41' });
createJuanFiApi({ vendoIp: 'http://10.1.0.41' });

timeoutMs defaults to 10000.

Pass custom fetch for tests, proxies, logging, or runtimes without globalThis.fetch.

const api = createJuanFiApi({
  vendoIp: '10.1.0.41',
  timeoutMs: 5000,
  fetch: myFetch,
});

result handling

JuanFI backend errors return values.

const result = await api.checkCoin({
  voucher: 'ABC123',
});

if (result.ok) {
  console.log(result.data.totalCoin);
} else {
  console.log(result.code);
  console.log(result.data);
}

Network, timeout, and parse failures throw.

common calls

start top-up

await api.startTopup({
  voucher: '',
  mac: 'AA:BB:CC:DD:EE:FF',
  ipAddress: '10.0.0.23',
  extendTime: false,
  topupType: 'INTERNET',
});

check coin

const result = await api.checkCoin({
  voucher: 'ABC123',
});

cancel top-up

await api.cancelTopup({
  voucher: 'ABC123',
  mac: 'AA:BB:CC:DD:EE:FF',
});

use voucher

await api.useVoucher({
  voucher: 'ABC123',
});

read rates

const rates = await api.getRates({
  rateType: 'internet',
});

Charging rates:

const rates = await api.getRates({
  rateType: 'charging',
});

read charging ports

const ports = await api.getChargingPorts();

read e-load products

const result = await api.getLoadProducts();

if (result.ok) {
  console.log(result.data);
}

With decompression:

const result = await api.getLoadProducts({
  decompress(raw) {
    return decompressRates(raw);
  },
});

start and finish e-load

const start = await api.startLoad({
  mobile: '09171234567',
  amount: 50,
  mac: 'AA:BB:CC:DD:EE:FF',
  hash: selectedProduct.hash,
  code: selectedProduct.code,
  trxNo: 'abc123xyz456789',
  trxTime: Date.now(),
});

if (!start.ok) {
  console.log(start.code);
  return;
}

await api.finishLoad({
  voucher: start.data.voucher,
});

known error codes

Known codes include:

  • coins.wait.expired
  • coin.not.inserted
  • coinslot.cancelled
  • coinslot.busy
  • coin.slot.banned
  • coin.slot.notavailable
  • no.internet.detected
  • product.hash.invalid
  • convertVoucher.empty
  • convertVoucher.invalid
  • load.not.enough
  • eload.failed
  • coin.is.reading

Handle unknown codes too.

parsing notes

JuanFI responses vary by endpoint and setup.

Current parsing:

  • rates: | rows, # columns
  • charging ports: | rows, # columns
  • voucher files: #
  • e-load products: line-based CSV-like rows
  • JSON backend errors: preserved in result.data

CDN

<script src="https://cdn.jsdelivr.net/npm/@svene/[email protected]/dist/juanfi-api.min.js"></script>

Browser global:

const api = JuanFiApi.createJuanFiApi({
  vendoIp: '10.1.0.41',
});

Download:

curl -L -o juanfi-api.js https://cdn.jsdelivr.net/npm/@svene/[email protected]/dist/juanfi-api.min.js

Do not use latest in production. Always pin the version.

scripts

npm run test -w @svene/juanfi-api
npm run build -w @svene/juanfi-api