From 2df0ba0ec58155d73830a66132cb635dc819e8a9 Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 30 Jan 2026 21:29:32 -0600 Subject: [PATCH] chore: add ts-rs generated bindings --- .gitignore | 4 +--- web/src/lib/bindings/CandidateResponse.ts | 6 ++++++ web/src/lib/bindings/CodeDescription.ts | 3 +++ web/src/lib/bindings/CourseResponse.ts | 5 +++++ web/src/lib/bindings/DbMeetingTime.ts | 6 ++++++ web/src/lib/bindings/InstructorDetail.ts | 6 ++++++ web/src/lib/bindings/InstructorDetailResponse.ts | 9 +++++++++ web/src/lib/bindings/InstructorListItem.ts | 7 +++++++ web/src/lib/bindings/InstructorResponse.ts | 3 +++ web/src/lib/bindings/InstructorStats.ts | 6 ++++++ web/src/lib/bindings/LinkedRmpProfile.ts | 6 ++++++ web/src/lib/bindings/ListInstructorsResponse.ts | 8 ++++++++ web/src/lib/bindings/OkResponse.ts | 6 ++++++ web/src/lib/bindings/RescoreResponse.ts | 6 ++++++ web/src/lib/bindings/ScraperStatsResponse.ts | 3 +++ web/src/lib/bindings/SearchResponse.ts | 4 ++++ web/src/lib/bindings/ServiceInfo.ts | 4 ++++ web/src/lib/bindings/ServiceStatus.ts | 6 ++++++ web/src/lib/bindings/StatusResponse.ts | 5 +++++ web/src/lib/bindings/SubjectDetailResponse.ts | 4 ++++ web/src/lib/bindings/SubjectResultEntry.ts | 3 +++ web/src/lib/bindings/SubjectSummary.ts | 3 +++ web/src/lib/bindings/SubjectsResponse.ts | 4 ++++ web/src/lib/bindings/TimelineResponse.ts | 12 ++++++++++++ web/src/lib/bindings/TimelineSlot.ts | 11 +++++++++++ web/src/lib/bindings/TimeseriesPoint.ts | 3 +++ web/src/lib/bindings/TimeseriesResponse.ts | 4 ++++ web/src/lib/bindings/TopCandidateResponse.ts | 6 ++++++ web/src/lib/bindings/User.ts | 6 ++++++ web/src/lib/bindings/serde_json/JsonValue.ts | 3 +++ 30 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 web/src/lib/bindings/CandidateResponse.ts create mode 100644 web/src/lib/bindings/CodeDescription.ts create mode 100644 web/src/lib/bindings/CourseResponse.ts create mode 100644 web/src/lib/bindings/DbMeetingTime.ts create mode 100644 web/src/lib/bindings/InstructorDetail.ts create mode 100644 web/src/lib/bindings/InstructorDetailResponse.ts create mode 100644 web/src/lib/bindings/InstructorListItem.ts create mode 100644 web/src/lib/bindings/InstructorResponse.ts create mode 100644 web/src/lib/bindings/InstructorStats.ts create mode 100644 web/src/lib/bindings/LinkedRmpProfile.ts create mode 100644 web/src/lib/bindings/ListInstructorsResponse.ts create mode 100644 web/src/lib/bindings/OkResponse.ts create mode 100644 web/src/lib/bindings/RescoreResponse.ts create mode 100644 web/src/lib/bindings/ScraperStatsResponse.ts create mode 100644 web/src/lib/bindings/SearchResponse.ts create mode 100644 web/src/lib/bindings/ServiceInfo.ts create mode 100644 web/src/lib/bindings/ServiceStatus.ts create mode 100644 web/src/lib/bindings/StatusResponse.ts create mode 100644 web/src/lib/bindings/SubjectDetailResponse.ts create mode 100644 web/src/lib/bindings/SubjectResultEntry.ts create mode 100644 web/src/lib/bindings/SubjectSummary.ts create mode 100644 web/src/lib/bindings/SubjectsResponse.ts create mode 100644 web/src/lib/bindings/TimelineResponse.ts create mode 100644 web/src/lib/bindings/TimelineSlot.ts create mode 100644 web/src/lib/bindings/TimeseriesPoint.ts create mode 100644 web/src/lib/bindings/TimeseriesResponse.ts create mode 100644 web/src/lib/bindings/TopCandidateResponse.ts create mode 100644 web/src/lib/bindings/User.ts create mode 100644 web/src/lib/bindings/serde_json/JsonValue.ts diff --git a/.gitignore b/.gitignore index 18e57e0..a1948a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ .env /target -# ts-rs bindings -web/src/lib/bindings/**/*.ts -!web/src/lib/bindings/index.ts + diff --git a/web/src/lib/bindings/CandidateResponse.ts b/web/src/lib/bindings/CandidateResponse.ts new file mode 100644 index 0000000..8bc16bc --- /dev/null +++ b/web/src/lib/bindings/CandidateResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * A match candidate in the detail view. + */ +export type CandidateResponse = { id: number, rmpLegacyId: number, firstName: string | null, lastName: string | null, department: string | null, avgRating: number | null, avgDifficulty: number | null, numRatings: number | null, wouldTakeAgainPct: number | null, score: number | null, scoreBreakdown: { [key in string]?: number } | null, status: string, }; diff --git a/web/src/lib/bindings/CodeDescription.ts b/web/src/lib/bindings/CodeDescription.ts new file mode 100644 index 0000000..d84bf6e --- /dev/null +++ b/web/src/lib/bindings/CodeDescription.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type CodeDescription = { code: string, description: string, }; diff --git a/web/src/lib/bindings/CourseResponse.ts b/web/src/lib/bindings/CourseResponse.ts new file mode 100644 index 0000000..c607316 --- /dev/null +++ b/web/src/lib/bindings/CourseResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DbMeetingTime } from "./DbMeetingTime"; +import type { InstructorResponse } from "./InstructorResponse"; + +export type CourseResponse = { crn: string, subject: string, courseNumber: string, title: string, termCode: string, sequenceNumber: string | null, instructionalMethod: string | null, campus: string | null, enrollment: number, maxEnrollment: number, waitCount: number, waitCapacity: number, creditHours: number | null, creditHourLow: number | null, creditHourHigh: number | null, crossList: string | null, crossListCapacity: number | null, crossListCount: number | null, linkIdentifier: string | null, isSectionLinked: boolean | null, partOfTerm: string | null, meetingTimes: Array, attributes: Array, instructors: Array, }; diff --git a/web/src/lib/bindings/DbMeetingTime.ts b/web/src/lib/bindings/DbMeetingTime.ts new file mode 100644 index 0000000..f79aebc --- /dev/null +++ b/web/src/lib/bindings/DbMeetingTime.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Represents a meeting time stored as JSONB in the courses table. + */ +export type DbMeetingTime = { begin_time: string | null, end_time: string | null, start_date: string, end_date: string, monday: boolean, tuesday: boolean, wednesday: boolean, thursday: boolean, friday: boolean, saturday: boolean, sunday: boolean, building: string | null, building_description: string | null, room: string | null, campus: string | null, meeting_type: string, meeting_schedule_type: string, }; diff --git a/web/src/lib/bindings/InstructorDetail.ts b/web/src/lib/bindings/InstructorDetail.ts new file mode 100644 index 0000000..4317abd --- /dev/null +++ b/web/src/lib/bindings/InstructorDetail.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Instructor summary in the detail view. + */ +export type InstructorDetail = { id: number, displayName: string, email: string, rmpMatchStatus: string, subjectsTaught: Array, courseCount: number, }; diff --git a/web/src/lib/bindings/InstructorDetailResponse.ts b/web/src/lib/bindings/InstructorDetailResponse.ts new file mode 100644 index 0000000..2809970 --- /dev/null +++ b/web/src/lib/bindings/InstructorDetailResponse.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CandidateResponse } from "./CandidateResponse"; +import type { InstructorDetail } from "./InstructorDetail"; +import type { LinkedRmpProfile } from "./LinkedRmpProfile"; + +/** + * Response for `GET /api/admin/instructors/{id}` and `POST .../match`. + */ +export type InstructorDetailResponse = { instructor: InstructorDetail, currentMatches: Array, candidates: Array, }; diff --git a/web/src/lib/bindings/InstructorListItem.ts b/web/src/lib/bindings/InstructorListItem.ts new file mode 100644 index 0000000..b68de8a --- /dev/null +++ b/web/src/lib/bindings/InstructorListItem.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TopCandidateResponse } from "./TopCandidateResponse"; + +/** + * An instructor row in the paginated list. + */ +export type InstructorListItem = { id: number, displayName: string, email: string, rmpMatchStatus: string, rmpLinkCount: number, candidateCount: number, courseSubjectCount: number, topCandidate: TopCandidateResponse | null, }; diff --git a/web/src/lib/bindings/InstructorResponse.ts b/web/src/lib/bindings/InstructorResponse.ts new file mode 100644 index 0000000..2af3afd --- /dev/null +++ b/web/src/lib/bindings/InstructorResponse.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type InstructorResponse = { instructorId: number, bannerId: string, displayName: string, email: string, isPrimary: boolean, rmpRating: number | null, rmpNumRatings: number | null, rmpLegacyId: number | null, }; diff --git a/web/src/lib/bindings/InstructorStats.ts b/web/src/lib/bindings/InstructorStats.ts new file mode 100644 index 0000000..498b704 --- /dev/null +++ b/web/src/lib/bindings/InstructorStats.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Aggregate status counts for the instructor list. + */ +export type InstructorStats = { total: number, unmatched: number, auto: number, confirmed: number, rejected: number, withCandidates: number, }; diff --git a/web/src/lib/bindings/LinkedRmpProfile.ts b/web/src/lib/bindings/LinkedRmpProfile.ts new file mode 100644 index 0000000..719e03b --- /dev/null +++ b/web/src/lib/bindings/LinkedRmpProfile.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * A linked RMP profile in the detail view. + */ +export type LinkedRmpProfile = { linkId: number, legacyId: number, firstName: string | null, lastName: string | null, department: string | null, avgRating: number | null, avgDifficulty: number | null, numRatings: number | null, wouldTakeAgainPct: number | null, }; diff --git a/web/src/lib/bindings/ListInstructorsResponse.ts b/web/src/lib/bindings/ListInstructorsResponse.ts new file mode 100644 index 0000000..7170483 --- /dev/null +++ b/web/src/lib/bindings/ListInstructorsResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstructorListItem } from "./InstructorListItem"; +import type { InstructorStats } from "./InstructorStats"; + +/** + * Response for `GET /api/admin/instructors`. + */ +export type ListInstructorsResponse = { instructors: Array, total: number, page: number, perPage: number, stats: InstructorStats, }; diff --git a/web/src/lib/bindings/OkResponse.ts b/web/src/lib/bindings/OkResponse.ts new file mode 100644 index 0000000..870af1a --- /dev/null +++ b/web/src/lib/bindings/OkResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Simple acknowledgement response for mutating operations. + */ +export type OkResponse = { ok: boolean, }; diff --git a/web/src/lib/bindings/RescoreResponse.ts b/web/src/lib/bindings/RescoreResponse.ts new file mode 100644 index 0000000..9e303df --- /dev/null +++ b/web/src/lib/bindings/RescoreResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Response for `POST /api/admin/rmp/rescore`. + */ +export type RescoreResponse = { totalUnmatched: number, candidatesCreated: number, candidatesRescored: number, autoMatched: number, skippedUnparseable: number, skippedNoCandidates: number, }; diff --git a/web/src/lib/bindings/ScraperStatsResponse.ts b/web/src/lib/bindings/ScraperStatsResponse.ts new file mode 100644 index 0000000..159192e --- /dev/null +++ b/web/src/lib/bindings/ScraperStatsResponse.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ScraperStatsResponse = { period: string, totalScrapes: number, successfulScrapes: number, failedScrapes: number, successRate: number | null, avgDurationMs: number | null, totalCoursesChanged: number, totalCoursesFetched: number, totalAuditsGenerated: number, pendingJobs: number, lockedJobs: number, }; diff --git a/web/src/lib/bindings/SearchResponse.ts b/web/src/lib/bindings/SearchResponse.ts new file mode 100644 index 0000000..de23284 --- /dev/null +++ b/web/src/lib/bindings/SearchResponse.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CourseResponse } from "./CourseResponse"; + +export type SearchResponse = { courses: Array, totalCount: number, offset: number, limit: number, }; diff --git a/web/src/lib/bindings/ServiceInfo.ts b/web/src/lib/bindings/ServiceInfo.ts new file mode 100644 index 0000000..7f8dc99 --- /dev/null +++ b/web/src/lib/bindings/ServiceInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ServiceStatus } from "./ServiceStatus"; + +export type ServiceInfo = { name: string, status: ServiceStatus, }; diff --git a/web/src/lib/bindings/ServiceStatus.ts b/web/src/lib/bindings/ServiceStatus.ts new file mode 100644 index 0000000..528cb4e --- /dev/null +++ b/web/src/lib/bindings/ServiceStatus.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Health status of a service. + */ +export type ServiceStatus = "starting" | "active" | "connected" | "disabled" | "error"; diff --git a/web/src/lib/bindings/StatusResponse.ts b/web/src/lib/bindings/StatusResponse.ts new file mode 100644 index 0000000..d9c2e46 --- /dev/null +++ b/web/src/lib/bindings/StatusResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ServiceInfo } from "./ServiceInfo"; +import type { ServiceStatus } from "./ServiceStatus"; + +export type StatusResponse = { status: ServiceStatus, version: string, commit: string, services: { [key in string]?: ServiceInfo }, }; diff --git a/web/src/lib/bindings/SubjectDetailResponse.ts b/web/src/lib/bindings/SubjectDetailResponse.ts new file mode 100644 index 0000000..8df1f0a --- /dev/null +++ b/web/src/lib/bindings/SubjectDetailResponse.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubjectResultEntry } from "./SubjectResultEntry"; + +export type SubjectDetailResponse = { subject: string, results: Array, }; diff --git a/web/src/lib/bindings/SubjectResultEntry.ts b/web/src/lib/bindings/SubjectResultEntry.ts new file mode 100644 index 0000000..09e420e --- /dev/null +++ b/web/src/lib/bindings/SubjectResultEntry.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SubjectResultEntry = { id: number, completedAt: string, durationMs: number, success: boolean, errorMessage: string | null, coursesFetched: number | null, coursesChanged: number | null, coursesUnchanged: number | null, auditsGenerated: number | null, metricsGenerated: number | null, }; diff --git a/web/src/lib/bindings/SubjectSummary.ts b/web/src/lib/bindings/SubjectSummary.ts new file mode 100644 index 0000000..a33be46 --- /dev/null +++ b/web/src/lib/bindings/SubjectSummary.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SubjectSummary = { subject: string, subjectDescription: string | null, trackedCourseCount: number, scheduleState: string, currentIntervalSecs: number, timeMultiplier: number, lastScraped: string, nextEligibleAt: string | null, cooldownRemainingSecs: number | null, avgChangeRatio: number, consecutiveZeroChanges: number, recentRuns: number, recentFailures: number, }; diff --git a/web/src/lib/bindings/SubjectsResponse.ts b/web/src/lib/bindings/SubjectsResponse.ts new file mode 100644 index 0000000..69bb799 --- /dev/null +++ b/web/src/lib/bindings/SubjectsResponse.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubjectSummary } from "./SubjectSummary"; + +export type SubjectsResponse = { subjects: Array, }; diff --git a/web/src/lib/bindings/TimelineResponse.ts b/web/src/lib/bindings/TimelineResponse.ts new file mode 100644 index 0000000..14ee81c --- /dev/null +++ b/web/src/lib/bindings/TimelineResponse.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TimelineSlot } from "./TimelineSlot"; + +export type TimelineResponse = { +/** + * 15-minute slots with per-subject enrollment totals, sorted by time. + */ +slots: Array, +/** + * All subject codes present in the returned data. + */ +subjects: Array, }; diff --git a/web/src/lib/bindings/TimelineSlot.ts b/web/src/lib/bindings/TimelineSlot.ts new file mode 100644 index 0000000..eb4ffe3 --- /dev/null +++ b/web/src/lib/bindings/TimelineSlot.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TimelineSlot = { +/** + * ISO-8601 timestamp at the start of this 15-minute bucket. + */ +time: string, +/** + * Subject code → total enrollment in this slot. + */ +subjects: { [key in string]?: bigint }, }; diff --git a/web/src/lib/bindings/TimeseriesPoint.ts b/web/src/lib/bindings/TimeseriesPoint.ts new file mode 100644 index 0000000..2b3d9de --- /dev/null +++ b/web/src/lib/bindings/TimeseriesPoint.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TimeseriesPoint = { timestamp: string, scrapeCount: number, successCount: number, errorCount: number, coursesChanged: number, avgDurationMs: number, }; diff --git a/web/src/lib/bindings/TimeseriesResponse.ts b/web/src/lib/bindings/TimeseriesResponse.ts new file mode 100644 index 0000000..ba67ebe --- /dev/null +++ b/web/src/lib/bindings/TimeseriesResponse.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TimeseriesPoint } from "./TimeseriesPoint"; + +export type TimeseriesResponse = { period: string, bucket: string, points: Array, }; diff --git a/web/src/lib/bindings/TopCandidateResponse.ts b/web/src/lib/bindings/TopCandidateResponse.ts new file mode 100644 index 0000000..60abe13 --- /dev/null +++ b/web/src/lib/bindings/TopCandidateResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * A top-candidate summary shown in the instructor list view. + */ +export type TopCandidateResponse = { rmpLegacyId: number, score: number | null, scoreBreakdown: { [key in string]?: number } | null, firstName: string | null, lastName: string | null, department: string | null, avgRating: number | null, numRatings: number | null, }; diff --git a/web/src/lib/bindings/User.ts b/web/src/lib/bindings/User.ts new file mode 100644 index 0000000..8bac5c1 --- /dev/null +++ b/web/src/lib/bindings/User.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * A user authenticated via Discord OAuth. + */ +export type User = { discordId: string, discordUsername: string, discordAvatarHash: string | null, isAdmin: boolean, createdAt: string, updatedAt: string, }; diff --git a/web/src/lib/bindings/serde_json/JsonValue.ts b/web/src/lib/bindings/serde_json/JsonValue.ts new file mode 100644 index 0000000..3ad5da8 --- /dev/null +++ b/web/src/lib/bindings/serde_json/JsonValue.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type JsonValue = number | string | boolean | Array | { [key in string]?: JsonValue } | null;