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

@enochmk/engrafi-client

v1.0.0

Published

Engrafi API client for AirtelTigo

Readme

@enochmk/engrafi-client

Typed Engrafi API client for AirtelTigo SIM registration, customer-detail lookup, and MSISDN churn/recycling.

Installation

npm install @enochmk/engrafi-client

For local live-endpoint testing, copy .env.example to .env and set the endpoint values. The .env file is gitignored and must be loaded by your application or test runner.

cp .env.example .env

Run the live smoke tests from the package directory:

npm run test:get-details
npm run test:churn

Pass a different MSISDN as the first argument when needed:

node tests/manual/get-details.mjs 576795786
node tests/manual/churn.mjs 576795786

These commands build the library, load the gitignored .env, call the live endpoints, and exit with a failure status when the operation is unsuccessful.

Quick start

import { EngrafiClient } from '@enochmk/engrafi-client';

const client = new EngrafiClient({
  baseUrl: process.env.ENGRAFI_BASE_URL!,
  churnUrl: process.env.ENGRAFI_CHURN_URL,
  customerDetailsUrl: process.env.ENGRAFI_CUSTOMER_DETAILS_URL,
});

const result = await client.getDetails(process.env.ENGRAFI_TEST_MSISDN!);
if (result.success) {
  console.log(result.data?.responseMap.customerDetails);
} else {
  console.error(result.error);
}

The client does not load .env files automatically. Use the environment loader already used by your application, or pass the endpoint strings directly to EngrafiClient.

Configuration

| Option | Required | Default | Description | | -------------------- | -------- | --------------------------------- | ------------------------------------ | | baseUrl | Yes | — | Engrafi host URL | | churnUrl | No | ${baseUrl}/recycle | Churn/recycle endpoint URL | | customerDetailsUrl | No | ${baseUrl}/get-customer-details | Customer lookup endpoint URL | | timeout | No | 10000 | HTTP timeout in milliseconds | | successCodes | No | ['FL0000', 'SC0000'] | Successful registration status codes | | logger | No | {} | Optional compatible logger methods |

API

registerSim(input)

Registers a SIM through /mnp-registration. The request requires the identity and SIM fields shown below. The client supplies Engrafi defaults for optional fields, and explicit input values override those defaults.

const result = await client.registerSim({
  firstName: 'Ama',
  lastName: 'Mensah',
  msisdn: '233271234567',
  iccid: '8923300000000000001',
  gender: 'FEMALE',
  dateOfBirth: '1990-01-01',
  nationality: 'GHANAIAN',
  docType: 'Passport',
  docNumber: 'P0000001',
  userName: 'agent',
});

getCustomerDetails(msisdn) / getDetails(msisdn)

Queries the configured customer-details endpoint with { msisdn }. getDetails is an alias for getCustomerDetails. Any successful HTTP response is returned as a successful lookup result, including an empty customer list.

const result = await client.getDetails('576795786');

if (result.success) {
  const customers = result.data?.responseMap.customerDetails ?? [];
  console.log(customers);
}

churn(msisdn)

Recycles a number through /recycle. Only SC0000 is treated as success.

const client = new EngrafiClient({
  baseUrl: 'http://10.81.1.98:8000',
  churnUrl: 'http://10.81.1.105:29080/Middleware/api/adapter/v2/engrafi/recycle',
});

const result = await client.churn('576795786');

if (result.success) {
  console.log('MSISDN recycled');
} else {
  console.error(result.statusCode, result.error);
}

SC0000 is the only successful churn status code. For example, an HTTP 500 response with statusCode: "FL0000" is returned as { success: false } rather than thrown.

Result handling

Expected Engrafi rejection, HTTP, timeout, and network failures are returned rather than thrown. Check success before reading data:

export interface EngrafiResult<T> {
  success: boolean;
  data?: T;
  statusCode?: string;
  request?: unknown;
  response?: unknown;
  httpStatus?: number;
  error?: string;
}

License

MIT