bsuir-iis-api 0.6.6 → 0.6.7

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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ This changelog is maintained manually and updated in release commits.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.6.7] - 2026-04-02
12
+
13
+ ### Changed
14
+
15
+ - Dev tooling: bumped TypeScript to 6.x, `@typescript-eslint/*` and `typescript-eslint` to ^8.58.0, `vitest` and `@vitest/coverage-v8` to ^4.1.2; added `@microsoft/api-extractor` for declaration emit; regenerated `package-lock.json`.
16
+ - Build: enable tsup [`experimentalDts`](https://tsup.egoist.dev/) (API Extractor) instead of the default DTS plugin so declaration builds work on TypeScript 6 without relying on deprecated `baseUrl` injection.
17
+ - Dev: npm [`overrides`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides) pin transitive `lodash` to ^4.17.24 so `npm audit` stays clean with `@microsoft/api-extractor`.
18
+
19
+ ### Documentation
20
+
21
+ - README: note on `experimentalDts` / API Extractor and TypeScript [`paths` without `baseUrl`](https://www.typescriptlang.org/docs/handbook/modules/reference.html).
22
+
11
23
  ## [0.6.6] - 2026-03-23
12
24
 
13
25
  ### Changed
package/README.md CHANGED
@@ -144,6 +144,8 @@ npm run check
144
144
  npm run build
145
145
  ```
146
146
 
147
+ `npm run build` uses [tsup](https://tsup.egoist.dev/) with [`experimentalDts`](https://tsup.egoist.dev/) so `.d.ts` output is produced via `@microsoft/api-extractor` rather than the legacy Rollup declaration path (which is awkward with TypeScript 6’s `baseUrl` deprecation). TypeScript’s handbook notes that [`paths` can be used without `baseUrl`](https://www.typescriptlang.org/docs/handbook/modules/reference.html) when you need path mapping.
148
+
147
149
  Linting uses ESLint flat config with strict type-aware TypeScript rules for `src`,
148
150
  plus test-specific overrides for `test` and `vitest.config.ts`.
149
151
 
@@ -0,0 +1,537 @@
1
+ import { Options } from 'tsup';
2
+ import { UserConfig } from 'vite';
3
+
4
+ declare interface Announcement {
5
+ id: number;
6
+ employee: string;
7
+ content: string;
8
+ date: string;
9
+ employeeDepartments: string[];
10
+ studentGroups: StudentGroupShort[];
11
+ }
12
+ export { Announcement }
13
+ export { Announcement as Announcement_alias_1 }
14
+ export { Announcement as Announcement_alias_2 }
15
+
16
+ /** Payload from IIS legacy `last-update-date/*` endpoints (`schedule.getLastUpdateByGroup` / `getLastUpdateByEmployee`). */
17
+ declare interface ApiDateResponse {
18
+ lastUpdateDate: string;
19
+ }
20
+ export { ApiDateResponse }
21
+ export { ApiDateResponse as ApiDateResponse_alias_1 }
22
+ export { ApiDateResponse as ApiDateResponse_alias_2 }
23
+
24
+ export declare function assertEmployeeUrlId(value: unknown, fieldName?: string): asserts value is string;
25
+
26
+ export declare function assertGroupNumber(value: unknown, fieldName?: string): asserts value is string;
27
+
28
+ export declare function assertNonEmptyString(value: unknown, fieldName: string): asserts value is string;
29
+
30
+ export declare function assertPositiveInt(value: unknown, fieldName: string): asserts value is number;
31
+
32
+ declare interface Auditory {
33
+ id: number;
34
+ name: string;
35
+ note: string;
36
+ capacity: number | null;
37
+ auditoryType: AuditoryType;
38
+ buildingNumber: BuildingNumber;
39
+ department: AuditoryDepartment;
40
+ }
41
+ export { Auditory }
42
+ export { Auditory as Auditory_alias_1 }
43
+ export { Auditory as Auditory_alias_2 }
44
+
45
+ declare interface AuditoryDepartment {
46
+ idDepartment: number;
47
+ abbrev: string;
48
+ name: string;
49
+ nameAndAbbrev: string;
50
+ }
51
+ export { AuditoryDepartment }
52
+ export { AuditoryDepartment as AuditoryDepartment_alias_1 }
53
+ export { AuditoryDepartment as AuditoryDepartment_alias_2 }
54
+
55
+ declare interface AuditoryType {
56
+ id: number;
57
+ name: string;
58
+ abbrev: string;
59
+ }
60
+ export { AuditoryType }
61
+ export { AuditoryType as AuditoryType_alias_1 }
62
+ export { AuditoryType as AuditoryType_alias_2 }
63
+
64
+ declare class BsuirApiError extends Error {
65
+ readonly status: number;
66
+ readonly endpoint: string;
67
+ readonly body: unknown;
68
+ constructor(message: string, status: number, endpoint: string, body: unknown);
69
+ }
70
+ export { BsuirApiError }
71
+ export { BsuirApiError as BsuirApiError_alias_1 }
72
+
73
+ /**
74
+ * Public client contract returned by {@link createBsuirClient}.
75
+ */
76
+ declare type BsuirClient = ReturnType<typeof createBsuirClient>;
77
+ export { BsuirClient }
78
+ export { BsuirClient as BsuirClient_alias_1 }
79
+
80
+ /**
81
+ * Options accepted by {@link createBsuirClient}.
82
+ */
83
+ declare interface BsuirClientOptions {
84
+ baseUrl?: string;
85
+ fetch?: typeof globalThis.fetch;
86
+ /** Request timeout per attempt, in milliseconds. */
87
+ timeoutMs?: number;
88
+ /** Number of retry attempts for retriable GET failures. */
89
+ retries?: number;
90
+ /** Base retry delay before backoff, in milliseconds. */
91
+ retryDelayMs?: number;
92
+ /** Upper bound for retry delay, in milliseconds. */
93
+ retryMaxDelayMs?: number;
94
+ /** Enable jitter for retry backoff to avoid synchronized retries. */
95
+ retryJitter?: boolean;
96
+ /** Optional User-Agent header (used mainly in Node.js runtimes). */
97
+ userAgent?: string;
98
+ /** Force raw API payload for schedule endpoints by default. */
99
+ defaultRaw?: boolean;
100
+ }
101
+ export { BsuirClientOptions }
102
+ export { BsuirClientOptions as BsuirClientOptions_alias_1 }
103
+
104
+ declare class BsuirNetworkError extends Error {
105
+ readonly endpoint: string;
106
+ readonly causeError: unknown;
107
+ constructor(message: string, endpoint: string, causeError: unknown);
108
+ }
109
+ export { BsuirNetworkError }
110
+ export { BsuirNetworkError as BsuirNetworkError_alias_1 }
111
+
112
+ declare class BsuirTimeoutError extends Error {
113
+ readonly endpoint: string;
114
+ readonly timeoutMs: number;
115
+ constructor(message: string, endpoint: string, timeoutMs: number);
116
+ }
117
+ export { BsuirTimeoutError }
118
+ export { BsuirTimeoutError as BsuirTimeoutError_alias_1 }
119
+
120
+ declare class BsuirValidationError extends Error {
121
+ constructor(message: string);
122
+ }
123
+ export { BsuirValidationError }
124
+ export { BsuirValidationError as BsuirValidationError_alias_1 }
125
+
126
+ declare interface BuildingNumber {
127
+ id: number;
128
+ name: string;
129
+ }
130
+ export { BuildingNumber }
131
+ export { BuildingNumber as BuildingNumber_alias_1 }
132
+ export { BuildingNumber as BuildingNumber_alias_2 }
133
+
134
+ export declare function createAnnouncementsModule(config: InternalClientConfig): {
135
+ /**
136
+ * Lists announcements for an employee. IIS may return HTTP `404` or `400` (no list / endpoint quirks); the SDK maps those to `[]`.
137
+ */
138
+ byEmployee(urlId: string, options?: ReadOptions): Promise<Announcement[]>;
139
+ /**
140
+ * Lists announcements for a department. IIS may return HTTP `404` or `400` (no list / endpoint quirks); the SDK maps those to `[]`.
141
+ */
142
+ byDepartment(id: number, options?: ReadOptions): Promise<Announcement[]>;
143
+ };
144
+
145
+ export declare function createAuditoriesModule(config: InternalClientConfig): {
146
+ listAll(options?: ReadOptions): Promise<Auditory[]>;
147
+ };
148
+
149
+ /**
150
+ * Creates a configured BSUIR IIS API client.
151
+ */
152
+ declare function createBsuirClient(options?: BsuirClientOptions): {
153
+ schedule: {
154
+ getGroup: <TRaw extends boolean | undefined = undefined>(groupNumber: string, options?: ReadOptions & {
155
+ raw?: TRaw;
156
+ }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
157
+ getEmployee: <TRaw extends boolean | undefined = undefined>(urlId: string, options?: ReadOptions & {
158
+ raw?: TRaw;
159
+ }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
160
+ getGroupFiltered: (groupNumber: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
161
+ getEmployeeFiltered: (urlId: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
162
+ getGroupExams(groupNumber: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
163
+ getEmployeeExams(urlId: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
164
+ getGroupBySubgroup(groupNumber: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
165
+ getEmployeeBySubgroup(urlId: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
166
+ getCurrentWeek: (options?: ReadOptions) => Promise<number>;
167
+ getLastUpdateByGroup(params: {
168
+ groupNumber: string;
169
+ } | {
170
+ id: number;
171
+ }, options?: ReadOptions): Promise<ApiDateResponse>;
172
+ getLastUpdateByEmployee(params: {
173
+ urlId: string;
174
+ } | {
175
+ id: number;
176
+ }, options?: ReadOptions): Promise<ApiDateResponse>;
177
+ };
178
+ groups: {
179
+ listAll(options?: ReadOptions): Promise<StudentGroupCatalogItem[]>;
180
+ };
181
+ employees: {
182
+ listAll(options?: ReadOptions): Promise<EmployeeCatalogItem[]>;
183
+ };
184
+ faculties: {
185
+ listAll(options?: ReadOptions): Promise<Faculty[]>;
186
+ };
187
+ departments: {
188
+ listAll(options?: ReadOptions): Promise<Department[]>;
189
+ };
190
+ specialities: {
191
+ listAll(options?: ReadOptions): Promise<Speciality[]>;
192
+ };
193
+ announcements: {
194
+ byEmployee(urlId: string, options?: ReadOptions): Promise<Announcement[]>;
195
+ byDepartment(id: number, options?: ReadOptions): Promise<Announcement[]>;
196
+ };
197
+ auditories: {
198
+ listAll(options?: ReadOptions): Promise<Auditory[]>;
199
+ };
200
+ };
201
+ export { createBsuirClient }
202
+ export { createBsuirClient as createBsuirClient_alias_1 }
203
+
204
+ export declare function createDepartmentsModule(config: InternalClientConfig): {
205
+ listAll(options?: ReadOptions): Promise<Department[]>;
206
+ };
207
+
208
+ export declare function createEmployeesModule(config: InternalClientConfig): {
209
+ listAll(options?: ReadOptions): Promise<EmployeeCatalogItem[]>;
210
+ };
211
+
212
+ export declare function createFacultiesModule(config: InternalClientConfig): {
213
+ listAll(options?: ReadOptions): Promise<Faculty[]>;
214
+ };
215
+
216
+ export declare function createGroupsModule(config: InternalClientConfig): {
217
+ listAll(options?: ReadOptions): Promise<StudentGroupCatalogItem[]>;
218
+ };
219
+
220
+ export declare function createJsonResponse({ status, headers, body }: MockResponseInit): Response;
221
+
222
+ export declare function createScheduleModule(config: InternalClientConfig): {
223
+ getGroup: <TRaw extends boolean | undefined = undefined>(groupNumber: string, options?: ReadOptions & {
224
+ raw?: TRaw;
225
+ }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
226
+ getEmployee: <TRaw extends boolean | undefined = undefined>(urlId: string, options?: ReadOptions & {
227
+ raw?: TRaw;
228
+ }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
229
+ getGroupFiltered: (groupNumber: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
230
+ getEmployeeFiltered: (urlId: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
231
+ getGroupExams(groupNumber: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
232
+ getEmployeeExams(urlId: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
233
+ getGroupBySubgroup(groupNumber: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
234
+ getEmployeeBySubgroup(urlId: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
235
+ getCurrentWeek: (options?: ReadOptions) => Promise<number>;
236
+ /**
237
+ * Calls IIS `/last-update-date/student-group`. That route is legacy and unsupported on the server;
238
+ * it may return an error for newer group numbers (e.g. six-digit `524404`).
239
+ */
240
+ getLastUpdateByGroup(params: {
241
+ groupNumber: string;
242
+ } | {
243
+ id: number;
244
+ }, options?: ReadOptions): Promise<ApiDateResponse>;
245
+ /**
246
+ * Calls IIS `/last-update-date/employee`. That route is legacy and unsupported on the server; prefer
247
+ * not relying on it for critical cache logic.
248
+ */
249
+ getLastUpdateByEmployee(params: {
250
+ urlId: string;
251
+ } | {
252
+ id: number;
253
+ }, options?: ReadOptions): Promise<ApiDateResponse>;
254
+ };
255
+
256
+ export declare function createSpecialitiesModule(config: InternalClientConfig): {
257
+ listAll(options?: ReadOptions): Promise<Speciality[]>;
258
+ };
259
+
260
+ export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
261
+
262
+ export declare const default_alias_1: UserConfig;
263
+
264
+ declare interface Department {
265
+ id: number;
266
+ name: string;
267
+ abbrev: string;
268
+ }
269
+ export { Department }
270
+ export { Department as Department_alias_1 }
271
+ export { Department as Department_alias_2 }
272
+
273
+ declare interface EducationForm {
274
+ id: number;
275
+ name: string;
276
+ }
277
+ export { EducationForm }
278
+ export { EducationForm as EducationForm_alias_1 }
279
+ export { EducationForm as EducationForm_alias_2 }
280
+
281
+ declare interface Employee {
282
+ firstName: string;
283
+ lastName: string;
284
+ middleName: string;
285
+ degree: string;
286
+ degreeAbbrev?: string;
287
+ email: Maybe<string>;
288
+ rank: Maybe<string>;
289
+ photoLink: string;
290
+ calendarId: string;
291
+ id: number;
292
+ urlId: string;
293
+ jobPositions: Maybe<string[]>;
294
+ }
295
+ export { Employee }
296
+ export { Employee as Employee_alias_1 }
297
+ export { Employee as Employee_alias_2 }
298
+
299
+ declare interface EmployeeCatalogItem {
300
+ firstName: string;
301
+ lastName: string;
302
+ middleName: string;
303
+ degree: string;
304
+ rank: string;
305
+ photoLink: string;
306
+ calendarId: string;
307
+ academicDepartment?: string[];
308
+ id: number;
309
+ urlId: string;
310
+ fio: string;
311
+ }
312
+ export { EmployeeCatalogItem }
313
+ export { EmployeeCatalogItem as EmployeeCatalogItem_alias_1 }
314
+ export { EmployeeCatalogItem as EmployeeCatalogItem_alias_2 }
315
+
316
+ declare interface Faculty {
317
+ id: number;
318
+ name: string;
319
+ abbrev: string;
320
+ }
321
+ export { Faculty }
322
+ export { Faculty as Faculty_alias_1 }
323
+ export { Faculty as Faculty_alias_2 }
324
+
325
+ declare type FlattenedLessonsByDay = Partial<Record<Weekday, FlattenedScheduleItem[]>>;
326
+ export { FlattenedLessonsByDay }
327
+ export { FlattenedLessonsByDay as FlattenedLessonsByDay_alias_1 }
328
+ export { FlattenedLessonsByDay as FlattenedLessonsByDay_alias_2 }
329
+
330
+ declare interface FlattenedScheduleItem extends ScheduleItem {
331
+ day: Weekday | null;
332
+ source: "schedules" | "exams";
333
+ }
334
+ export { FlattenedScheduleItem }
335
+ export { FlattenedScheduleItem as FlattenedScheduleItem_alias_1 }
336
+ export { FlattenedScheduleItem as FlattenedScheduleItem_alias_2 }
337
+
338
+ export declare interface InternalClientConfig {
339
+ baseUrl: string;
340
+ fetchImpl: typeof globalThis.fetch;
341
+ timeoutMs: number;
342
+ retries: number;
343
+ retryDelayMs: number;
344
+ retryMaxDelayMs: number;
345
+ retryJitter: boolean;
346
+ userAgent: string | undefined;
347
+ defaultRaw: boolean;
348
+ }
349
+
350
+ export declare function isAbortError(error: unknown): boolean;
351
+
352
+ declare interface LessonStudentGroup {
353
+ specialityName: string;
354
+ specialityCode: string;
355
+ numberOfStudents: number;
356
+ name: string;
357
+ educationDegree: number;
358
+ }
359
+ export { LessonStudentGroup }
360
+ export { LessonStudentGroup as LessonStudentGroup_alias_1 }
361
+ export { LessonStudentGroup as LessonStudentGroup_alias_2 }
362
+
363
+ declare type Maybe<T> = T | null;
364
+ export { Maybe }
365
+ export { Maybe as Maybe_alias_1 }
366
+ export { Maybe as Maybe_alias_2 }
367
+
368
+ /**
369
+ * Combines an optional caller {@link AbortSignal} with a per-attempt timeout.
370
+ * When `AbortSignal.any` exists at runtime, delegates to the platform implementation.
371
+ * Otherwise uses a manual merge so the timeout still applies alongside a caller signal.
372
+ */
373
+ export declare function mergeSignals(signal: AbortSignal | undefined, timeoutMs: number): AbortSignal;
374
+
375
+ /** Used when `AbortSignal.any` is unavailable; exposed for unit tests. */
376
+ export declare function mergeSignalsManual(signal: AbortSignal | undefined, timeoutMs: number): AbortSignal;
377
+
378
+ export declare function mockFetchSequence(responses: Array<Response | Error>): typeof globalThis.fetch;
379
+
380
+ export declare interface MockResponseInit {
381
+ status?: number;
382
+ headers?: HeadersInit;
383
+ body: unknown;
384
+ }
385
+
386
+ declare interface NormalizedScheduleResponse extends Omit<ScheduleResponse, "schedules" | "exams"> {
387
+ schedules: WeekScheduleMap;
388
+ exams: ScheduleItem[];
389
+ lessons: FlattenedScheduleItem[];
390
+ lessonsByDay: FlattenedLessonsByDay;
391
+ scheduleLessons: FlattenedScheduleItem[];
392
+ examLessons: FlattenedScheduleItem[];
393
+ }
394
+ export { NormalizedScheduleResponse }
395
+ export { NormalizedScheduleResponse as NormalizedScheduleResponse_alias_1 }
396
+ export { NormalizedScheduleResponse as NormalizedScheduleResponse_alias_2 }
397
+
398
+ /**
399
+ * Normalizes current week payload from API to a positive integer.
400
+ * API can return plain text (`"1\n"`) or number.
401
+ */
402
+ export declare function parseCurrentWeek(payload: unknown): number;
403
+
404
+ export declare function parseDdMmYyyy(value: string | null): Date | null;
405
+
406
+ export declare type QueryParams = Record<string, QueryValue>;
407
+
408
+ export declare type QueryValue = string | number | boolean | null | undefined;
409
+
410
+ /**
411
+ * Read options used by all module methods.
412
+ */
413
+ declare interface ReadOptions extends RequestOptions {
414
+ /**
415
+ * When true, return raw API payload where supported.
416
+ */
417
+ raw?: boolean;
418
+ }
419
+ export { ReadOptions }
420
+ export { ReadOptions as ReadOptions_alias_1 }
421
+
422
+ export declare function requestJson<T>(config: InternalClientConfig, path: string, options?: RequestOptions): Promise<T>;
423
+
424
+ /**
425
+ * Common request options shared by read-only API methods.
426
+ */
427
+ declare interface RequestOptions {
428
+ /**
429
+ * Query parameters appended to endpoint URL.
430
+ */
431
+ query?: QueryParams | undefined;
432
+ /**
433
+ * Optional signal to cancel request from the caller side.
434
+ */
435
+ signal?: AbortSignal | undefined;
436
+ }
437
+ export { RequestOptions }
438
+ export { RequestOptions as RequestOptions_alias_1 }
439
+
440
+ declare interface ScheduleFilterOptions {
441
+ source?: "schedules" | "exams";
442
+ weekday?: Weekday;
443
+ weekNumber?: number;
444
+ subgroup?: number;
445
+ lessonTypeAbbrev?: string | string[];
446
+ subjectQuery?: string;
447
+ employeeUrlId?: string;
448
+ auditory?: string;
449
+ }
450
+ export { ScheduleFilterOptions }
451
+ export { ScheduleFilterOptions as ScheduleFilterOptions_alias_1 }
452
+ export { ScheduleFilterOptions as ScheduleFilterOptions_alias_2 }
453
+
454
+ declare interface ScheduleItem {
455
+ weekNumber: number[] | null;
456
+ studentGroups: LessonStudentGroup[];
457
+ numSubgroup: number;
458
+ auditories: string[];
459
+ startLessonTime: string;
460
+ endLessonTime: string;
461
+ subject: string;
462
+ subjectFullName: string;
463
+ note: Maybe<string>;
464
+ lessonTypeAbbrev: string | null;
465
+ dateLesson: Maybe<string>;
466
+ startLessonDate: Maybe<string>;
467
+ endLessonDate: Maybe<string>;
468
+ announcement: boolean;
469
+ split: boolean;
470
+ employees: Maybe<Employee[]>;
471
+ }
472
+ export { ScheduleItem }
473
+ export { ScheduleItem as ScheduleItem_alias_1 }
474
+ export { ScheduleItem as ScheduleItem_alias_2 }
475
+
476
+ declare interface ScheduleResponse {
477
+ employeeDto: Maybe<Employee>;
478
+ studentGroupDto: Maybe<StudentGroupCatalogItem>;
479
+ schedules: WeekScheduleMap | null;
480
+ exams: ScheduleItem[] | null;
481
+ startDate: Maybe<string>;
482
+ endDate: Maybe<string>;
483
+ startExamsDate: Maybe<string>;
484
+ endExamsDate: Maybe<string>;
485
+ }
486
+ export { ScheduleResponse }
487
+ export { ScheduleResponse as ScheduleResponse_alias_1 }
488
+ export { ScheduleResponse as ScheduleResponse_alias_2 }
489
+
490
+ declare interface Speciality {
491
+ id: number;
492
+ name: string;
493
+ abbrev: string;
494
+ educationForm: EducationForm[];
495
+ facultyId: number;
496
+ code: string;
497
+ }
498
+ export { Speciality }
499
+ export { Speciality as Speciality_alias_1 }
500
+ export { Speciality as Speciality_alias_2 }
501
+
502
+ declare interface StudentGroupCatalogItem {
503
+ name: string;
504
+ facultyId: number;
505
+ facultyName?: string;
506
+ facultyAbbrev?: string;
507
+ specialityDepartmentEducationFormId: number;
508
+ specialityName: string;
509
+ specialityAbbrev?: string;
510
+ course: number;
511
+ id: number;
512
+ calendarId: string;
513
+ educationDegree?: number;
514
+ }
515
+ export { StudentGroupCatalogItem }
516
+ export { StudentGroupCatalogItem as StudentGroupCatalogItem_alias_1 }
517
+ export { StudentGroupCatalogItem as StudentGroupCatalogItem_alias_2 }
518
+
519
+ declare interface StudentGroupShort {
520
+ id: number;
521
+ name: string;
522
+ }
523
+ export { StudentGroupShort }
524
+ export { StudentGroupShort as StudentGroupShort_alias_1 }
525
+ export { StudentGroupShort as StudentGroupShort_alias_2 }
526
+
527
+ declare type Weekday = "Понедельник" | "Вторник" | "Среда" | "Четверг" | "Пятница" | "Суббота";
528
+ export { Weekday }
529
+ export { Weekday as Weekday_alias_1 }
530
+ export { Weekday as Weekday_alias_2 }
531
+
532
+ declare type WeekScheduleMap = Partial<Record<Weekday, ScheduleItem[]>>;
533
+ export { WeekScheduleMap }
534
+ export { WeekScheduleMap as WeekScheduleMap_alias_1 }
535
+ export { WeekScheduleMap as WeekScheduleMap_alias_2 }
536
+
537
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,293 +1,33 @@
1
- type QueryValue = string | number | boolean | null | undefined;
2
- type QueryParams = Record<string, QueryValue>;
3
- /**
4
- * Common request options shared by read-only API methods.
5
- */
6
- interface RequestOptions {
7
- /**
8
- * Query parameters appended to endpoint URL.
9
- */
10
- query?: QueryParams | undefined;
11
- /**
12
- * Optional signal to cancel request from the caller side.
13
- */
14
- signal?: AbortSignal | undefined;
15
- }
16
- /**
17
- * Options accepted by {@link createBsuirClient}.
18
- */
19
- interface BsuirClientOptions {
20
- baseUrl?: string;
21
- fetch?: typeof globalThis.fetch;
22
- /** Request timeout per attempt, in milliseconds. */
23
- timeoutMs?: number;
24
- /** Number of retry attempts for retriable GET failures. */
25
- retries?: number;
26
- /** Base retry delay before backoff, in milliseconds. */
27
- retryDelayMs?: number;
28
- /** Upper bound for retry delay, in milliseconds. */
29
- retryMaxDelayMs?: number;
30
- /** Enable jitter for retry backoff to avoid synchronized retries. */
31
- retryJitter?: boolean;
32
- /** Optional User-Agent header (used mainly in Node.js runtimes). */
33
- userAgent?: string;
34
- /** Force raw API payload for schedule endpoints by default. */
35
- defaultRaw?: boolean;
36
- }
37
-
38
- /**
39
- * Creates a configured BSUIR IIS API client.
40
- */
41
- declare function createBsuirClient(options?: BsuirClientOptions): {
42
- schedule: {
43
- getGroup: <TRaw extends boolean | undefined = undefined>(groupNumber: string, options?: ReadOptions & {
44
- raw?: TRaw;
45
- }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
46
- getEmployee: <TRaw extends boolean | undefined = undefined>(urlId: string, options?: ReadOptions & {
47
- raw?: TRaw;
48
- }) => Promise<TRaw extends true ? ScheduleResponse : NormalizedScheduleResponse>;
49
- getGroupFiltered: (groupNumber: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
50
- getEmployeeFiltered: (urlId: string, filter: ScheduleFilterOptions, options?: ReadOptions) => Promise<FlattenedScheduleItem[]>;
51
- getGroupExams(groupNumber: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
52
- getEmployeeExams(urlId: string, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
53
- getGroupBySubgroup(groupNumber: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
54
- getEmployeeBySubgroup(urlId: string, subgroup: number, options?: ReadOptions): Promise<FlattenedScheduleItem[]>;
55
- getCurrentWeek: (options?: ReadOptions) => Promise<number>;
56
- getLastUpdateByGroup(params: {
57
- groupNumber: string;
58
- } | {
59
- id: number;
60
- }, options?: ReadOptions): Promise<ApiDateResponse>;
61
- getLastUpdateByEmployee(params: {
62
- urlId: string;
63
- } | {
64
- id: number;
65
- }, options?: ReadOptions): Promise<ApiDateResponse>;
66
- };
67
- groups: {
68
- listAll(options?: ReadOptions): Promise<StudentGroupCatalogItem[]>;
69
- };
70
- employees: {
71
- listAll(options?: ReadOptions): Promise<EmployeeCatalogItem[]>;
72
- };
73
- faculties: {
74
- listAll(options?: ReadOptions): Promise<Faculty[]>;
75
- };
76
- departments: {
77
- listAll(options?: ReadOptions): Promise<Department[]>;
78
- };
79
- specialities: {
80
- listAll(options?: ReadOptions): Promise<Speciality[]>;
81
- };
82
- announcements: {
83
- byEmployee(urlId: string, options?: ReadOptions): Promise<Announcement[]>;
84
- byDepartment(id: number, options?: ReadOptions): Promise<Announcement[]>;
85
- };
86
- auditories: {
87
- listAll(options?: ReadOptions): Promise<Auditory[]>;
88
- };
89
- };
90
- /**
91
- * Public client contract returned by {@link createBsuirClient}.
92
- */
93
- type BsuirClient = ReturnType<typeof createBsuirClient>;
94
-
95
- /**
96
- * Read options used by all module methods.
97
- */
98
- interface ReadOptions extends RequestOptions {
99
- /**
100
- * When true, return raw API payload where supported.
101
- */
102
- raw?: boolean;
103
- }
104
-
105
- declare class BsuirApiError extends Error {
106
- readonly status: number;
107
- readonly endpoint: string;
108
- readonly body: unknown;
109
- constructor(message: string, status: number, endpoint: string, body: unknown);
110
- }
111
- declare class BsuirNetworkError extends Error {
112
- readonly endpoint: string;
113
- readonly causeError: unknown;
114
- constructor(message: string, endpoint: string, causeError: unknown);
115
- }
116
- declare class BsuirTimeoutError extends Error {
117
- readonly endpoint: string;
118
- readonly timeoutMs: number;
119
- constructor(message: string, endpoint: string, timeoutMs: number);
120
- }
121
- declare class BsuirValidationError extends Error {
122
- constructor(message: string);
123
- }
124
-
125
- type Weekday = "Понедельник" | "Вторник" | "Среда" | "Четверг" | "Пятница" | "Суббота";
126
- /** Payload from IIS legacy `last-update-date/*` endpoints (`schedule.getLastUpdateByGroup` / `getLastUpdateByEmployee`). */
127
- interface ApiDateResponse {
128
- lastUpdateDate: string;
129
- }
130
- interface StudentGroupShort {
131
- id: number;
132
- name: string;
133
- }
134
- type Maybe<T> = T | null;
135
-
136
- interface Announcement {
137
- id: number;
138
- employee: string;
139
- content: string;
140
- date: string;
141
- employeeDepartments: string[];
142
- studentGroups: StudentGroupShort[];
143
- }
144
-
145
- interface Faculty {
146
- id: number;
147
- name: string;
148
- abbrev: string;
149
- }
150
- interface Department {
151
- id: number;
152
- name: string;
153
- abbrev: string;
154
- }
155
- interface EducationForm {
156
- id: number;
157
- name: string;
158
- }
159
- interface Speciality {
160
- id: number;
161
- name: string;
162
- abbrev: string;
163
- educationForm: EducationForm[];
164
- facultyId: number;
165
- code: string;
166
- }
167
- interface StudentGroupCatalogItem {
168
- name: string;
169
- facultyId: number;
170
- facultyName?: string;
171
- facultyAbbrev?: string;
172
- specialityDepartmentEducationFormId: number;
173
- specialityName: string;
174
- specialityAbbrev?: string;
175
- course: number;
176
- id: number;
177
- calendarId: string;
178
- educationDegree?: number;
179
- }
180
- interface AuditoryType {
181
- id: number;
182
- name: string;
183
- abbrev: string;
184
- }
185
- interface BuildingNumber {
186
- id: number;
187
- name: string;
188
- }
189
- interface AuditoryDepartment {
190
- idDepartment: number;
191
- abbrev: string;
192
- name: string;
193
- nameAndAbbrev: string;
194
- }
195
- interface Auditory {
196
- id: number;
197
- name: string;
198
- note: string;
199
- capacity: number | null;
200
- auditoryType: AuditoryType;
201
- buildingNumber: BuildingNumber;
202
- department: AuditoryDepartment;
203
- }
204
-
205
- interface Employee {
206
- firstName: string;
207
- lastName: string;
208
- middleName: string;
209
- degree: string;
210
- degreeAbbrev?: string;
211
- email: Maybe<string>;
212
- rank: Maybe<string>;
213
- photoLink: string;
214
- calendarId: string;
215
- id: number;
216
- urlId: string;
217
- jobPositions: Maybe<string[]>;
218
- }
219
- interface EmployeeCatalogItem {
220
- firstName: string;
221
- lastName: string;
222
- middleName: string;
223
- degree: string;
224
- rank: string;
225
- photoLink: string;
226
- calendarId: string;
227
- academicDepartment?: string[];
228
- id: number;
229
- urlId: string;
230
- fio: string;
231
- }
232
-
233
- interface LessonStudentGroup {
234
- specialityName: string;
235
- specialityCode: string;
236
- numberOfStudents: number;
237
- name: string;
238
- educationDegree: number;
239
- }
240
- interface ScheduleItem {
241
- weekNumber: number[] | null;
242
- studentGroups: LessonStudentGroup[];
243
- numSubgroup: number;
244
- auditories: string[];
245
- startLessonTime: string;
246
- endLessonTime: string;
247
- subject: string;
248
- subjectFullName: string;
249
- note: Maybe<string>;
250
- lessonTypeAbbrev: string | null;
251
- dateLesson: Maybe<string>;
252
- startLessonDate: Maybe<string>;
253
- endLessonDate: Maybe<string>;
254
- announcement: boolean;
255
- split: boolean;
256
- employees: Maybe<Employee[]>;
257
- }
258
- type WeekScheduleMap = Partial<Record<Weekday, ScheduleItem[]>>;
259
- interface ScheduleResponse {
260
- employeeDto: Maybe<Employee>;
261
- studentGroupDto: Maybe<StudentGroupCatalogItem>;
262
- schedules: WeekScheduleMap | null;
263
- exams: ScheduleItem[] | null;
264
- startDate: Maybe<string>;
265
- endDate: Maybe<string>;
266
- startExamsDate: Maybe<string>;
267
- endExamsDate: Maybe<string>;
268
- }
269
- interface FlattenedScheduleItem extends ScheduleItem {
270
- day: Weekday | null;
271
- source: "schedules" | "exams";
272
- }
273
- type FlattenedLessonsByDay = Partial<Record<Weekday, FlattenedScheduleItem[]>>;
274
- interface ScheduleFilterOptions {
275
- source?: "schedules" | "exams";
276
- weekday?: Weekday;
277
- weekNumber?: number;
278
- subgroup?: number;
279
- lessonTypeAbbrev?: string | string[];
280
- subjectQuery?: string;
281
- employeeUrlId?: string;
282
- auditory?: string;
283
- }
284
- interface NormalizedScheduleResponse extends Omit<ScheduleResponse, "schedules" | "exams"> {
285
- schedules: WeekScheduleMap;
286
- exams: ScheduleItem[];
287
- lessons: FlattenedScheduleItem[];
288
- lessonsByDay: FlattenedLessonsByDay;
289
- scheduleLessons: FlattenedScheduleItem[];
290
- examLessons: FlattenedScheduleItem[];
291
- }
292
-
293
- export { type Announcement, type ApiDateResponse, type Auditory, type AuditoryDepartment, type AuditoryType, BsuirApiError, type BsuirClient, type BsuirClientOptions, BsuirNetworkError, BsuirTimeoutError, BsuirValidationError, type BuildingNumber, type Department, type EducationForm, type Employee, type EmployeeCatalogItem, type Faculty, type FlattenedLessonsByDay, type FlattenedScheduleItem, type LessonStudentGroup, type Maybe, type NormalizedScheduleResponse, type ReadOptions, type RequestOptions, type ScheduleFilterOptions, type ScheduleItem, type ScheduleResponse, type Speciality, type StudentGroupCatalogItem, type StudentGroupShort, type WeekScheduleMap, type Weekday, createBsuirClient };
1
+ export { createBsuirClient } from './_tsup-dts-rollup.js';
2
+ export { BsuirClient } from './_tsup-dts-rollup.js';
3
+ export { BsuirClientOptions } from './_tsup-dts-rollup.js';
4
+ export { RequestOptions } from './_tsup-dts-rollup.js';
5
+ export { ReadOptions } from './_tsup-dts-rollup.js';
6
+ export { BsuirApiError } from './_tsup-dts-rollup.js';
7
+ export { BsuirNetworkError } from './_tsup-dts-rollup.js';
8
+ export { BsuirTimeoutError } from './_tsup-dts-rollup.js';
9
+ export { BsuirValidationError } from './_tsup-dts-rollup.js';
10
+ export { Announcement } from './_tsup-dts-rollup.js';
11
+ export { Faculty } from './_tsup-dts-rollup.js';
12
+ export { Department } from './_tsup-dts-rollup.js';
13
+ export { EducationForm } from './_tsup-dts-rollup.js';
14
+ export { Speciality } from './_tsup-dts-rollup.js';
15
+ export { StudentGroupCatalogItem } from './_tsup-dts-rollup.js';
16
+ export { AuditoryType } from './_tsup-dts-rollup.js';
17
+ export { BuildingNumber } from './_tsup-dts-rollup.js';
18
+ export { AuditoryDepartment } from './_tsup-dts-rollup.js';
19
+ export { Auditory } from './_tsup-dts-rollup.js';
20
+ export { Weekday } from './_tsup-dts-rollup.js';
21
+ export { ApiDateResponse } from './_tsup-dts-rollup.js';
22
+ export { StudentGroupShort } from './_tsup-dts-rollup.js';
23
+ export { Maybe } from './_tsup-dts-rollup.js';
24
+ export { Employee } from './_tsup-dts-rollup.js';
25
+ export { EmployeeCatalogItem } from './_tsup-dts-rollup.js';
26
+ export { LessonStudentGroup } from './_tsup-dts-rollup.js';
27
+ export { ScheduleItem } from './_tsup-dts-rollup.js';
28
+ export { WeekScheduleMap } from './_tsup-dts-rollup.js';
29
+ export { ScheduleResponse } from './_tsup-dts-rollup.js';
30
+ export { FlattenedScheduleItem } from './_tsup-dts-rollup.js';
31
+ export { FlattenedLessonsByDay } from './_tsup-dts-rollup.js';
32
+ export { ScheduleFilterOptions } from './_tsup-dts-rollup.js';
33
+ export { NormalizedScheduleResponse } from './_tsup-dts-rollup.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bsuir-iis-api",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Type-safe ESM SDK for BSUIR IIS API",
5
5
  "type": "module",
6
6
  "author": "kotru21",
@@ -53,19 +53,23 @@
53
53
  "release:dry": "npm pack --dry-run"
54
54
  },
55
55
  "devDependencies": {
56
+ "@microsoft/api-extractor": "^7.58.0",
56
57
  "@changesets/cli": "^2.30.0",
57
58
  "@eslint/js": "^10.0.1",
58
59
  "@types/node": "^25.5.0",
59
- "@typescript-eslint/eslint-plugin": "^8.57.2",
60
- "@typescript-eslint/parser": "^8.57.2",
61
- "@vitest/coverage-v8": "^4.1.1",
60
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
61
+ "@typescript-eslint/parser": "^8.58.0",
62
+ "@vitest/coverage-v8": "^4.1.2",
62
63
  "eslint": "^10.1.0",
63
64
  "eslint-config-prettier": "^10.1.8",
64
65
  "globals": "^17.4.0",
65
66
  "prettier": "^3.8.1",
66
67
  "tsup": "^8.5.1",
67
- "typescript": "^5.9.3",
68
- "typescript-eslint": "^8.57.2",
69
- "vitest": "^4.1.1"
68
+ "typescript": "^6.0.2",
69
+ "typescript-eslint": "^8.58.0",
70
+ "vitest": "^4.1.2"
71
+ },
72
+ "overrides": {
73
+ "lodash": "^4.17.24"
70
74
  }
71
75
  }