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

@midlyr/sdk-js

v0.1.0

Published

MidLyr Enterprise TypeScript SDK for REST APIs.

Downloads

80

Readme

@midlyr/sdk-js

Thin TypeScript SDK for MidLyr Enterprise REST APIs.

This package intentionally owns only shared API-calling behavior. Future MCP and CLI packages should depend on the SDK through the public @midlyr/sdk-js export instead of duplicating REST transport code.

Install

npm install @midlyr/sdk-js
pnpm add @midlyr/sdk-js
yarn add @midlyr/sdk-js
bun add @midlyr/sdk-js

Create a client

import { Midlyr } from "@midlyr/sdk-js";

const midlyr = new Midlyr({
  apiKey: process.env.MIDLYR_API_KEY!,
  // Override for staging, local development, or private deployments.
  baseUrl: "https://api.midlyr.com",
});

Requests authenticate with the x-api-key header.

Regulation API

const page = await midlyr.regulations.browse({
  query: "fair lending",
  jurisdictions: "us-federal",
  limit: 25,
});

const details = await midlyr.regulations.getDetails(page.results[0]!.id);

const content = await midlyr.regulations.readContent(page.results[0]!.id, {
  limit: 4_000,
});

Analysis APIs

const response = await midlyr.analysis.screen({
  content: { type: "text", text: "Get 0% APR for life!" },
  scenario: "marketing_asset",
});

const job = await midlyr.jobs.get(response.id);

Job API

The SDK exposes jobs.get(id) only. Jobs use a discriminated union on status: "running", "succeeded", or "failed". It does not provide a polling helper; MCP and CLI layers can decide their own polling or display behavior later.

Timeout and retries

The SDK uses native fetch and has no runtime HTTP-client dependency. Configure timeout and safe retries globally:

const midlyr = new Midlyr({
  apiKey: process.env.MIDLYR_API_KEY!,
  timeoutMs: 30_000,
  maxRetries: 1,
});

You can also override them per request:

await midlyr.regulations.browse({ query: "Regulation B" }, { timeoutMs: 10_000, maxRetries: 2 });

Retries are intentionally conservative:

  • safe GET requests may retry network failures, timeouts, and HTTP 408, 429, 500, 502, 503, or 504 responses;
  • mutating POST requests are not retried by default until the API supports an idempotency strategy;
  • Retry-After is respected when the API returns it.

Errors

import { MidlyrAPIError, MidlyrNetworkError } from "@midlyr/sdk-js";

try {
  await midlyr.regulations.getDetails("missing");
} catch (error) {
  if (error instanceof MidlyrAPIError) {
    console.error(error.status, error.code, error.message);
  }

  if (error instanceof MidlyrNetworkError) {
    console.error(error.isTimeout ? "Timed out" : "Network failure");
  }
}

Current scope

@midlyr/sdk-js v0 wraps the current regulation/compliance REST endpoints:

Out of scope for this package pass:

  • MCP tool implementations;
  • CLI command behavior;
  • job polling helpers;
  • a separate resilience package;
  • a runtime dependency on ky or another HTTP client.