bsuir-iis-api 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +23 -2
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.1] - 2026-05-13
4
+
5
+ ### Documentation
6
+
7
+ - README: clarified `defaultRaw` behavior for `schedule.getGroup()` / `schedule.getEmployee()` when per-call `raw` is omitted.
8
+ - README: clarified retry semantics (GET retries cover retriable HTTP statuses and network/transport errors).
9
+ - README: documented `maxResponseBytes` failure behavior (`BsuirApiError` on oversized payloads).
10
+ - README: made usage snippets standalone by adding required imports/client initialization.
11
+ - README: added explicit public export reference for runtime helpers, error classes, and exported domain/types surface.
12
+
13
+ ### Changed
14
+
15
+ - Changelog restored explicit `0.8.0` section and separated `0.9.0` release-management metadata.
16
+ - Changelog now marks `0.10.0` behavior shifts with potentially breaking downstream impact notes.
17
+
3
18
  ## [0.10.0] - 2026-05-13
4
19
 
5
20
  ### Added
@@ -18,6 +33,12 @@
18
33
  - GitHub Actions in CI/release workflows are pinned to commit SHAs.
19
34
  - Dev dependencies in `package.json` are now pinned to exact versions.
20
35
 
36
+ ### Potentially Breaking
37
+
38
+ - `baseUrl` validation is now strict; previously accepted non-normalized/less-safe values can now throw `BsuirConfigurationError`.
39
+ - `validateResponses` defaults to `true`; integrations that relied on unchecked payloads may now see `BsuirResponseValidationError`.
40
+ - Response body size is now actively enforced via `maxResponseBytes`; oversized responses now fail fast with `BsuirApiError`.
41
+
21
42
  ### Fixed
22
43
 
23
44
  - Response parser now enforces `maxResponseBytes` for both `Content-Length` pre-checks and streamed body reads.
@@ -40,6 +61,12 @@
40
61
 
41
62
  ## [0.9.0] - 2026-05-10
42
63
 
64
+ ### Changed
65
+
66
+ - Release-management update from Changesets (`version: 0.9.0` + release metadata). Runtime API/content remained aligned with the `0.8.0` code snapshot.
67
+
68
+ ## [0.8.0] - 2026-05-10
69
+
43
70
  ### Added
44
71
 
45
72
  - Public exports for schedule utilities: `normalizeSchedule` and `filterLessons`.
package/README.md CHANGED
@@ -31,6 +31,8 @@ console.log(schedule.lessons.length);
31
31
  ## Client options
32
32
 
33
33
  ```ts
34
+ import { createBsuirClient } from "bsuir-iis-api";
35
+
34
36
  const client = createBsuirClient({
35
37
  baseUrl: "https://iis.bsuir.by/api/v1",
36
38
  allowedBaseUrlHosts: ["iis.bsuir.by"],
@@ -99,11 +101,20 @@ const client = createBsuirClient({
99
101
 
100
102
  When IIS responds with HTTP `404` or `400` (no list, missing resource, or endpoint quirks), these methods resolve to an empty array `[]` instead of throwing `BsuirApiError`. Client-side validation still runs first (`urlId`, department `id`). If IIS later returns a meaningful `400` for bad parameters, it will also map to `[]`; other HTTP errors are unchanged.
101
103
 
104
+ ### Public exports (runtime utilities and types)
105
+
106
+ - Core runtime API: `createBsuirClient`, `BsuirClient`
107
+ - Client/runtime option types: `BsuirClientOptions`, `CacheOptions`, `ClientHooks`, `RequestOptions`, `ReadOptions`, `RequestHookContext`, `RetryHookContext`, `ResponseHookContext`, `ErrorHookContext`
108
+ - Schedule utilities: `normalizeSchedule`, `filterLessons`, `ScheduleFilterOptions`
109
+ - Error classes: `BsuirApiError`, `BsuirNetworkError`, `BsuirTimeoutError`, `BsuirValidationError`, `BsuirResponseValidationError`, `BsuirConfigurationError`
110
+ - Domain types: `Announcement`, `ApiDateResponse`, `Auditory`, `AuditoryDepartment`, `AuditoryType`, `BuildingNumber`, `Department`, `EducationForm`, `Employee`, `EmployeeCatalogItem`, `Faculty`, `FlattenedLessonsByDay`, `FlattenedScheduleItem`, `LessonStudentGroup`, `Maybe`, `NormalizedScheduleResponse`, `ScheduleItem`, `ScheduleResponse`, `Speciality`, `StudentGroupCatalogItem`, `StudentGroupShort`, `Weekday`, `WeekScheduleMap`
111
+
102
112
  ## Errors
103
113
 
104
114
  SDK throws typed errors:
105
115
 
106
116
  - `BsuirApiError` for HTTP errors (contains `status`, `endpoint`, `body`). **Exception:** `client.announcements.byEmployee` / `byDepartment` resolve to `[]` on IIS HTTP `404` or `400` instead of throwing (see Announcements above).
117
+ - `BsuirApiError` is also used when response body size exceeds configured `maxResponseBytes`.
107
118
  - `BsuirNetworkError` for transport errors (contains `endpoint` and standard `cause`)
108
119
  - `BsuirResponseValidationError` for invalid payload shapes when `validateResponses: true`
109
120
  - `BsuirTimeoutError` for timeouts (contains `endpoint`, `timeoutMs`)
@@ -117,7 +128,7 @@ Validation rules:
117
128
  - `id` and `subgroup` parameters must be positive integers
118
129
  Retry and abort behavior:
119
130
 
120
- - Retries are applied to `429`, `500`, `502`, `503`, `504`
131
+ - Retries are applied to GET requests for transport/network errors and HTTP `429`, `500`, `502`, `503`, `504`
121
132
  - `Retry-After` is respected for retriable responses
122
133
  - Caller-provided aborted `AbortSignal` is re-thrown as native `AbortError`
123
134
  - Internal timeout is mapped to `BsuirTimeoutError`
@@ -131,17 +142,21 @@ For **2xx** responses the client reads the body as text, then applies `JSON.pars
131
142
  - Valid JSON is returned even when `Content-Type` does **not** include `application/json` (mislabeled responses still parse).
132
143
  - If `Content-Type` indicates **`application/json`** but the body is empty or not valid JSON, the client throws `BsuirApiError` (`Invalid JSON response payload`), same as for a truncated `{` payload.
133
144
  - If the body is **empty** and the content type does **not** indicate JSON, the result is an empty string `""` (analogous to reading plain text). Typical IIS catalog JSON endpoints return a non-empty body.
145
+ - If response body size exceeds `maxResponseBytes`, the client throws `BsuirApiError`.
134
146
 
135
147
  ## Raw vs normalized schedule response
136
148
 
137
149
  By default, schedule methods return a **normalized** `NormalizedScheduleResponse`: `lessons` is all flattened items (weekly + exams), each tagged with `source: "schedules" | "exams"`; `scheduleLessons` / `examLessons` are the same rows split by source; `lessonsByDay` groups by weekday.
138
150
 
139
151
  ```ts
152
+ import { createBsuirClient } from "bsuir-iis-api";
153
+
154
+ const client = createBsuirClient();
140
155
  const raw = await client.schedule.getGroup("053503", { raw: true });
141
156
  ```
142
157
 
143
158
  Use `defaultRaw: true` in `createBsuirClient` to change global behavior.
144
- When `raw` is omitted, `getGroup()` and `getEmployee()` return normalized payload.
159
+ When `raw` is omitted, `getGroup()` and `getEmployee()` follow client `defaultRaw` (`false` by default, so normalized unless explicitly changed to `true`).
145
160
  In raw mode API may return `schedules: null`; normalized mode always converts it to `{}`.
146
161
  In raw mode some lesson fields may also be nullable (`weekNumber`, `lessonTypeAbbrev`), so keep null checks if you consume raw payload directly.
147
162
  README examples match the installed package version; if types and docs ever diverge, rely on `NormalizedScheduleResponse` / `ScheduleResponse` from the same release.
@@ -154,6 +169,9 @@ The SDK normalizes `current-week` payloads, including plain-text responses like
154
169
  Filtering example:
155
170
 
156
171
  ```ts
172
+ import { createBsuirClient } from "bsuir-iis-api";
173
+
174
+ const client = createBsuirClient();
157
175
  const exams = await client.schedule.getGroupFiltered("053503", {
158
176
  source: "exams",
159
177
  lessonTypeAbbrev: ["Консультация", "Экзамен"]
@@ -161,6 +179,9 @@ const exams = await client.schedule.getGroupFiltered("053503", {
161
179
  ```
162
180
 
163
181
  ```ts
182
+ import { createBsuirClient } from "bsuir-iis-api";
183
+
184
+ const client = createBsuirClient();
164
185
  const subgroupLessons = await client.schedule.getEmployeeBySubgroup("s-nesterenkov", 1);
165
186
  ```
166
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bsuir-iis-api",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Type-safe ESM SDK for BSUIR IIS API",
5
5
  "type": "module",
6
6
  "author": "kotru21",