juno-erp-client
v1.0.1
Published
A high-level TypeScript API wrapper for the JUNO Campus ERP platform, supporting automated login and session persistence.
Maintainers
Readme
Juno ERP Client
A high-level TypeScript API wrapper for the JUNO Campus ERP system (MGM University). This library simplifies programmatic access to student information, academic details, attendance, results, and fees.
Features
- 🔐 Automated Authentication: Handles the multi-step Juno login process (including JSESSIONID acquisition and session priming).
- 💾 Session Persistence: Built-in support for saving and loading cookies to/from a local file or external storage.
- 📘 Type Safe: Fully written in TypeScript with comprehensive interfaces for all API responses.
- ⚡ Easy to Use: Simplified methods for common tasks like checking attendance, results, and timetables.
Installation
npm install juno-erp-clientQuick Start
Basic Login
import { JunoClient } from 'juno-erp-client';
const client = new JunoClient({ debug: true });
const success = await client.login('your_username', 'your_password');
if (success) {
const profile = await client.getStudentProfile();
console.log(`LoggedIn as: ${profile[0].firstName} ${profile[0].lastName}`);
}Session Persistence (File-based)
Automatically save and reuse your session to avoid logging in every time.
const client = new JunoClient({
sessionPath: './.session/cookies.json', // Path to save cookies
autoSave: true // Default: true if sessionPath is provided
});
// Check if we have an active session
if (!(await client.isLoggedIn())) {
await client.login(username, password);
}
// Now you're ready to make API calls!
const results = await client.getStudentResults({
examScheduleId: '...',
examSemesterId: '...',
universitySyllabusId: 0
});Manual Session Export/Import
Useful for serverless environments (e.g., storing session in Redis or a DB).
// Export
const sessionData = client.exportSession();
// Import on a new instance
const newClient = new JunoClient();
newClient.importSession(sessionData);
if (await newClient.isLoggedIn()) {
console.log("Re-authenticated using exported session!");
}API Documentation
The client provides methods for:
- Student Information:
getStudentProfile,getPersonalInformation,getAcademicInfo,getAdmissionDetails. - Attendance:
getAttendanceDetails,getAttendanceGraph. - Academics:
getCourses,getStudentResults,getExamDetails. - Finance:
getFeesDetails,getStudentReceivable. - Schedule:
getTodaySchedule,getTimetableBetweenDates. - Utils:
search,getStudentIdFromSession.
All methods return strongly typed promises. Refer to the TypeScript definitions for detailed response structures.
Troubleshooting
Connectivity
If you encounter ECONNREFUSED or ETIMEDOUT, ensure that:
- The MGM University ERP (erp.mgmu.ac.in) is online.
- You are not blocked by a firewall or VPN.
Empty Responses
Some endpoints require specific session "priming". The library handles this during login(). If you are using session persistence, ensure the session has not expired on the server.
License
MIT © Denizuh
