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

@borrowbetter/amlassdk

v0.1.0

Published

Alleviate MLAS SDK

Readme

@borrowbetter/amlassdk

TypeScript SDK for the Alleviate MLAS platform. Wraps the GraphQL API for the lead service with automatic Azure AD authentication and full type safety.

Installation

npm install @borrowbetter/amlassdk

Requirements

  • Node.js >= 18
  • Azure AD client credentials (provided by your Alleviate account manager)

Quick Start

import { AlleviateMLAS } from "@borrowbetter/amlassdk";

const client = new AlleviateMLAS({
  environment: "sandbox", // or "production"
  auth: {
    clientId: process.env.AZURE_CLIENT_ID,
    clientSecret: process.env.AZURE_CLIENT_SECRET,
  },
});

Services

The lead service is accessed as a property on the client instance:

client.leadService

Lead Service

Manages lead creation, submission, status lookup, and referrals.

Create Lead

const result = await client.leadService.CreateLead({
  input: {
    firstName: "John",
    lastName: "Doe",
    email: "[email protected]",
    homePhone: "5551234567",
    address1: "123 Main St",
    city: "Atlanta",
    state: "GA",
    zipCode: "30301",
    estimatedDebt: 25000,
    loanPurposeId: 1,
    termsConsent: true,
  },
});

const { id, resultCode, note, bidValue } = result.createLead;

Submit Lead

After receiving a qualified result code (1013-1017) from createLead:

const submitResult = await client.leadService.SubmitLead({
  input: { leadId: id },
});

const { statusCode, crmRecordId, crm } = submitResult.submitLead;

Get Lead Status

const status = await client.leadService.GetLeadStatus({ id });

const { resultCode, updatedAt, bidValue } = status.getLeadStatus;

Create Referral

const referral = await client.leadService.CreateReferral({
  input: {
    firstName: "Jane",
    lastName: "Doe",
    email: "[email protected]",
    homePhone: "5559876543",
    state: "CA",
    dashboardId: 123,
    referralType: "ACCELERATOR_LOAN",
    payload: { customField: "value" },
  },
});

if (referral.createReferral.errors?.length) {
  console.error(referral.createReferral.errors);
} else {
  console.log(referral.createReferral.data);
}

Configuration

const client = new AlleviateMLAS({
  // Required
  environment: "sandbox" | "production",
  auth: {
    clientId: string,
    clientSecret: string,
  },

  // Optional
  headers?: Record<string, string>,  // Static headers added to every request
  timeout?: number,                  // Request timeout in ms (default: 30_000)
});

Custom Token Cache

By default tokens are cached in memory. For multi-process deployments (e.g. serverless, multiple workers) provide a shared cache implementation:

import { AlleviateMLAS, type TokenCache } from "@borrowbetter/amlassdk";

class RedisTokenCache implements TokenCache {
  async get() {
    return redis.get("mlas:token");
  }
  async set(token: string, expiresAt: Date) {
    const ttl = Math.max(0, Math.floor((expiresAt.getTime() - Date.now()) / 1000));
    await redis.set("mlas:token", token, { EX: ttl });
  }
}

const client = new AlleviateMLAS({
  environment: "production",
  auth: { clientId, clientSecret, cache: new RedisTokenCache() },
});

Raw Client Access

If you need direct access to the underlying graphql-request client:

client.rawLeadServiceClient

Type Exports

The service's generated types are available as a namespace export:

import {
  AlleviateMLAS,
  LeadService,
  type MLASConfig,
  type TokenCache,
} from "@borrowbetter/amlassdk";

Development

Setup

npm install
npm run dev      # codegen + tsup watch

Generated files (__generated__/sdk.ts) are excluded from source control and regenerated at build time.

Scripts

| Script | Description | |--------|-------------| | npm run build | Codegen + compile to dist/ | | npm run dev | Watch mode (codegen + tsup) | | npm run codegen | Regenerate TypeScript from GraphQL schemas | | npm run smoke | Run end-to-end smoke test against sandbox | | npm run lint | Biome lint check | | npm run format | Biome format + auto-fix | | npm run format:check | Biome CI check (no writes) | | npm run typecheck | TypeScript type check |

Smoke Test

cp .env.example .env.local  # add AZURE_CLIENT_ID and AZURE_CLIENT_SECRET
npm run smoke

Adding a New Service

  1. Place the SDL schema at src/schemas/{service-name}/schema.graphql
  2. Add operations under src/schemas/{service-name}/operations/
  3. Add the service name to the SERVICES array in codegen.ts
  4. Wire up the new client in AlleviateMLAS.ts
  5. Export the namespace from src/index.ts
  6. Run npm run codegen