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

bsuir-iis-api

v0.3.0

Published

Type-safe ESM SDK for BSUIR IIS API

Readme

bsuir-iis-api

Type-safe ESM SDK for BSUIR IIS API with support for Node.js and browser runtimes. Example project exist in this repo.

Install

npm install bsuir-iis-api

Quick start

import { createBsuirClient } from "bsuir-iis-api";

const client = createBsuirClient();

const schedule = await client.schedule.getGroup("053503");
console.log(schedule.lessons.length);

Client options

const client = createBsuirClient({
  baseUrl: "https://iis.bsuir.by/api/v1",
  timeoutMs: 10000,
  retries: 2,
  retryDelayMs: 300,
  retryMaxDelayMs: 3000,
  retryJitter: true,
  defaultRaw: false
});
  • fetch can be passed for custom runtime/testing.
  • AbortSignal is supported by all read methods.

API

Schedule

  • client.schedule.getGroup(groupNumber, options?)
  • client.schedule.getEmployee(urlId, options?)
  • client.schedule.getGroupFiltered(groupNumber, filter, options?)
  • client.schedule.getEmployeeFiltered(urlId, filter, options?)
  • client.schedule.getGroupExams(groupNumber, options?)
  • client.schedule.getEmployeeExams(urlId, options?)
  • client.schedule.getGroupBySubgroup(groupNumber, subgroup, options?)
  • client.schedule.getEmployeeBySubgroup(urlId, subgroup, options?)
  • client.schedule.getCurrentWeek(options?)
  • client.schedule.getLastUpdateByGroup({ groupNumber } | { id }, options?)
  • client.schedule.getLastUpdateByEmployee({ urlId } | { id }, options?)

Catalogs

  • client.groups.listAll(options?)
  • client.employees.listAll(options?)
  • client.faculties.listAll(options?)
  • client.departments.listAll(options?)
  • client.specialities.listAll(options?)
  • client.auditories.listAll(options?)

Announcements

  • client.announcements.byEmployee(urlId, options?)
  • client.announcements.byDepartment(id, options?)

Meta

  • client.currentWeek.get(options?) (alias to client.schedule.getCurrentWeek)
  • client.lastUpdate.byGroup({ groupNumber } | { id }, options?)
  • client.lastUpdate.byEmployee({ urlId } | { id }, options?)

Errors

SDK throws typed errors:

  • BsuirApiError for HTTP errors (contains status, endpoint, body)
  • BsuirNetworkError for transport errors (contains endpoint, causeError, and standard cause)
  • BsuirTimeoutError for timeouts (contains endpoint, timeoutMs)
  • BsuirValidationError for invalid input parameters

Validation rules:

  • groupNumber must contain digits only

  • urlId must be a slug with letters/digits/hyphens (for example s-nesterenkov)

  • id and subgroup parameters must be positive integers Retry and abort behavior:

  • Retries are applied to 429, 500, 502, 503, 504

  • Retry-After is respected for retriable responses

  • Caller-provided aborted AbortSignal is re-thrown as native AbortError

  • Internal timeout is mapped to BsuirTimeoutError

createBsuirClient() throws regular Error if no fetch implementation is available.

Raw vs normalized schedule response

By default, schedule methods return normalized response with lessons, lessonsByDay, scheduleLessons, and examLessons.

const raw = await client.schedule.getGroup("053503", { raw: true });

Use defaultRaw: true in createBsuirClient to change global behavior. When raw is omitted, getGroup() and getEmployee() return normalized payload. In raw mode API may return schedules: null; normalized mode always converts it to {}. In raw mode some lesson fields may also be nullable (weekNumber, lessonTypeAbbrev), so keep null checks if you consume raw payload directly.

Current week

getCurrentWeek() returns the current week value directly from IIS API. The SDK normalizes current-week payloads, including plain-text responses like 1\n.

Filtering example:

const exams = await client.schedule.getGroupFiltered("053503", {
  source: "exams",
  lessonTypeAbbrev: ["Консультация", "Экзамен"]
});
const subgroupLessons = await client.schedule.getEmployeeBySubgroup("s-nesterenkov", 1);

Development

npm install
npm run lint
npm run lint:fix
npm run check
npm run build

Linting uses ESLint flat config with strict type-aware TypeScript rules for src, plus test-specific overrides for test and vitest.config.ts.

Live contract tests against real BSUIR API are opt-in:

BSUIR_LIVE_TESTS=1 npm run test:live

PowerShell:

$env:BSUIR_LIVE_TESTS="1"; npm run test:live

CI has a manual workflow_dispatch path that also runs live contracts (live-contract job).

Release checklist

  1. Run npm run check:full.
  2. Update version and CHANGELOG.md in the same release commit.
  3. Push to main to trigger GitHub Actions release workflow.
  4. Verify published package in a clean project:
mkdir bsuir-iis-smoke && cd bsuir-iis-smoke
npm init -y
npm install bsuir-iis-api@latest
node -e "import('bsuir-iis-api').then(m=>console.log(typeof m.createBsuirClient))"

The project keeps CHANGELOG.md manually curated for stable release notes.

License

MIT