juno-erp-client 1.0.0
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/LICENSE +19 -0
- package/README.md +99 -0
- package/dist/index.d.ts +198 -0
- package/dist/index.js +642 -0
- package/dist/types/index.d.ts +463 -0
- package/dist/types/index.js +2 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 Danish
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Juno ERP Client
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/juno-erp-client)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
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.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🔐 **Automated Authentication**: Handles the multi-step Juno login process (including JSESSIONID acquisition and session priming).
|
|
11
|
+
- 💾 **Session Persistence**: Built-in support for saving and loading cookies to/from a local file or external storage.
|
|
12
|
+
- 📘 **Type Safe**: Fully written in TypeScript with comprehensive interfaces for all API responses.
|
|
13
|
+
- ⚡ **Easy to Use**: Simplified methods for common tasks like checking attendance, results, and timetables.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install juno-erp-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Basic Login
|
|
24
|
+
```typescript
|
|
25
|
+
import { JunoClient } from 'juno-erp-client';
|
|
26
|
+
|
|
27
|
+
const client = new JunoClient({ debug: true });
|
|
28
|
+
|
|
29
|
+
const success = await client.login('your_username', 'your_password');
|
|
30
|
+
if (success) {
|
|
31
|
+
const profile = await client.getStudentProfile();
|
|
32
|
+
console.log(`LoggedIn as: ${profile[0].firstName} ${profile[0].lastName}`);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Session Persistence (File-based)
|
|
37
|
+
Automatically save and reuse your session to avoid logging in every time.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const client = new JunoClient({
|
|
41
|
+
sessionPath: './.session/cookies.json', // Path to save cookies
|
|
42
|
+
autoSave: true // Default: true if sessionPath is provided
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Check if we have an active session
|
|
46
|
+
if (!(await client.isLoggedIn())) {
|
|
47
|
+
await client.login(username, password);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Now you're ready to make API calls!
|
|
51
|
+
const results = await client.getStudentResults({
|
|
52
|
+
examScheduleId: '...',
|
|
53
|
+
examSemesterId: '...',
|
|
54
|
+
universitySyllabusId: 0
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Manual Session Export/Import
|
|
59
|
+
Useful for serverless environments (e.g., storing session in Redis or a DB).
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Export
|
|
63
|
+
const sessionData = client.exportSession();
|
|
64
|
+
|
|
65
|
+
// Import on a new instance
|
|
66
|
+
const newClient = new JunoClient();
|
|
67
|
+
newClient.importSession(sessionData);
|
|
68
|
+
|
|
69
|
+
if (await newClient.isLoggedIn()) {
|
|
70
|
+
console.log("Re-authenticated using exported session!");
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## API Documentation
|
|
75
|
+
|
|
76
|
+
The client provides methods for:
|
|
77
|
+
|
|
78
|
+
- **Student Information**: `getStudentProfile`, `getPersonalInformation`, `getAcademicInfo`, `getAdmissionDetails`.
|
|
79
|
+
- **Attendance**: `getAttendanceDetails`, `getAttendanceGraph`.
|
|
80
|
+
- **Academics**: `getCourses`, `getStudentResults`, `getExamDetails`.
|
|
81
|
+
- **Finance**: `getFeesDetails`, `getStudentReceivable`.
|
|
82
|
+
- **Schedule**: `getTodaySchedule`, `getTimetableBetweenDates`.
|
|
83
|
+
- **Utils**: `search`, `getStudentIdFromSession`.
|
|
84
|
+
|
|
85
|
+
All methods return strongly typed promises. Refer to the TypeScript definitions for detailed response structures.
|
|
86
|
+
|
|
87
|
+
## Troubleshooting
|
|
88
|
+
|
|
89
|
+
### Connectivity
|
|
90
|
+
If you encounter `ECONNREFUSED` or `ETIMEDOUT`, ensure that:
|
|
91
|
+
1. The MGM University ERP (erp.mgmu.ac.in) is online.
|
|
92
|
+
2. You are not blocked by a firewall or VPN.
|
|
93
|
+
|
|
94
|
+
### Empty Responses
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT © [Denizuh](mailto:danishs2007@gmail.com)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { JunoConfig, StudentProfile, PersonalInfo, AcademicInfo, AdmissionDetail, Course, AttendanceDetails, AttendanceGraph, ResultDetail, ExamDetails, FeesDetails, StudentReceivable, TodaySchedule, DetailedTimetableEntry, SearchResult, Caste, Country, TransferDetail, TransferDetailsOfStudent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* JunoClient is a high-level API wrapper for the Juno ERP system.
|
|
4
|
+
* It handles session management, cookie persistence, and provides
|
|
5
|
+
* type-safe methods to access student data.
|
|
6
|
+
*/
|
|
7
|
+
export declare class JunoClient {
|
|
8
|
+
private api;
|
|
9
|
+
private jar;
|
|
10
|
+
private debug;
|
|
11
|
+
private sessionPath?;
|
|
12
|
+
private autoSave;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of the Juno API client.
|
|
15
|
+
* @param config - Configuration options for the client.
|
|
16
|
+
*/
|
|
17
|
+
constructor(config?: JunoConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Internal utility for logging debug information.
|
|
20
|
+
* @param method - The name of the method being logged.
|
|
21
|
+
* @param data - The data to log.
|
|
22
|
+
*/
|
|
23
|
+
private logDebug;
|
|
24
|
+
/**
|
|
25
|
+
* Saves the current session cookies to the configured sessionPath.
|
|
26
|
+
*/
|
|
27
|
+
saveSessionToFile(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Loads session cookies from the configured sessionPath and re-initializes the API instance.
|
|
30
|
+
*/
|
|
31
|
+
loadSessionFromFile(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Exports the current session data as a JSON-serializable object.
|
|
34
|
+
* Use this for manual session management (e.g., storing in a database).
|
|
35
|
+
* @returns The serialized session object.
|
|
36
|
+
*/
|
|
37
|
+
exportSession(): any;
|
|
38
|
+
/**
|
|
39
|
+
* Imports session data from a previously exported session object.
|
|
40
|
+
* @param data - The serialized session object.
|
|
41
|
+
*/
|
|
42
|
+
importSession(data: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the client is currently logged in and has a valid session.
|
|
45
|
+
* This method verifies the session by attempting to fetch the student ID.
|
|
46
|
+
* @returns A promise that resolves to true if logged in, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
isLoggedIn(): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Performs a multi-step login process to authenticate with the Juno ERP system.
|
|
51
|
+
* The process involves:
|
|
52
|
+
* 1. Acquiring an initial JSESSIONID from the login page.
|
|
53
|
+
* 2. Posting credentials to the security check endpoint.
|
|
54
|
+
* 3. Following redirects to activate the session.
|
|
55
|
+
* 4. Visiting the dashboard to prime the server-side context.
|
|
56
|
+
*
|
|
57
|
+
* @param username - The Juno ERP username.
|
|
58
|
+
* @param password - The Juno ERP password.
|
|
59
|
+
* @returns A promise that resolves to true if login was successful, false otherwise.
|
|
60
|
+
*/
|
|
61
|
+
login(username: string, password: string): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Fetches the student's basic profile information.
|
|
64
|
+
* @returns A promise that resolves to an array containing the student profile.
|
|
65
|
+
*/
|
|
66
|
+
getStudentProfile(): Promise<StudentProfile[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Fetches detailed personal contact and address information.
|
|
69
|
+
* @returns A promise resolving to an object containing PersonalInfo.
|
|
70
|
+
*/
|
|
71
|
+
getPersonalInformation(): Promise<{
|
|
72
|
+
hasUserLogin: boolean;
|
|
73
|
+
PersonalInfo: PersonalInfo;
|
|
74
|
+
hasPersonalInfo: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Fetches academic enrollment details like course, department, and semester.
|
|
78
|
+
* @returns A promise resolving to an array of AcademicInfo objects.
|
|
79
|
+
*/
|
|
80
|
+
getAcademicInfo(): Promise<AcademicInfo[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Fetches admission-related details and document submission status.
|
|
83
|
+
* @returns A promise resolving to an object containing AdmissionDetail.
|
|
84
|
+
*/
|
|
85
|
+
getAdmissionDetails(): Promise<{
|
|
86
|
+
hasAdmissionDetail: boolean;
|
|
87
|
+
AdmissionInfo: AdmissionDetail;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Fetches a list of all available castes from the system.
|
|
91
|
+
* @returns A promise resolving to an array of Caste objects.
|
|
92
|
+
*/
|
|
93
|
+
getAllCastes(): Promise<Caste[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Fetches a list of all countries for nationality selection.
|
|
96
|
+
* @returns A promise resolving to an array of Country objects.
|
|
97
|
+
*/
|
|
98
|
+
getCountryList(): Promise<Country[]>;
|
|
99
|
+
/**
|
|
100
|
+
* Fetches the list of courses for a given term (semester).
|
|
101
|
+
* @param termId - The internal ID for the term.
|
|
102
|
+
* @param params - Optional search and filtering parameters.
|
|
103
|
+
* @returns A promise resolving to an array of Course objects.
|
|
104
|
+
*/
|
|
105
|
+
getCourses(termId: number, params?: {
|
|
106
|
+
refreshData?: number;
|
|
107
|
+
subjectwisestudentids?: string;
|
|
108
|
+
subejctwiseBatchIds?: string;
|
|
109
|
+
batchsemestercapacity?: number;
|
|
110
|
+
}): Promise<Course[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Fetches high-level attendance summary statistics.
|
|
113
|
+
* @returns A promise resolving to AttendanceDetails.
|
|
114
|
+
*/
|
|
115
|
+
getAttendanceDetails(): Promise<AttendanceDetails>;
|
|
116
|
+
/**
|
|
117
|
+
* Fetches attendance distribution data for visualization/graphing.
|
|
118
|
+
* @param termId - The term to filter by. Defaults to 'All'.
|
|
119
|
+
* @returns A promise resolving to an array of AttendanceGraph data points.
|
|
120
|
+
*/
|
|
121
|
+
getAttendanceGraph(termId?: string): Promise<AttendanceGraph[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetches detailed marks and results for a specific examination.
|
|
124
|
+
* @param params - Parameters defining the specific exam schedule and syllabus.
|
|
125
|
+
* @returns A promise resolving to an array of ResultDetail objects.
|
|
126
|
+
*/
|
|
127
|
+
getStudentResults(params: {
|
|
128
|
+
examScheduleId: string;
|
|
129
|
+
examSemesterId: string;
|
|
130
|
+
universitySyllabusId: number;
|
|
131
|
+
}): Promise<ResultDetail[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Fetches overall examination performance and marks statistics.
|
|
134
|
+
* @returns A promise resolving to ExamDetails.
|
|
135
|
+
*/
|
|
136
|
+
getExamDetails(): Promise<ExamDetails>;
|
|
137
|
+
/**
|
|
138
|
+
* Fetches the current fee invoice and structure summary.
|
|
139
|
+
* @returns A promise resolving to FeesDetails.
|
|
140
|
+
*/
|
|
141
|
+
getFeesDetails(): Promise<FeesDetails>;
|
|
142
|
+
/**
|
|
143
|
+
* Fetches the detailed fee break-up for the current student.
|
|
144
|
+
* @returns A promise resolving to an array of fee items.
|
|
145
|
+
*/
|
|
146
|
+
getFeeStructureByStudentId(): Promise<any[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Alternative method to fetch fee structure from the student-side view.
|
|
149
|
+
* @returns A promise resolving to an array of fee items.
|
|
150
|
+
*/
|
|
151
|
+
getFeeStructureByStudentIdOfStudentSide(): Promise<any[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetches the total receivables, including academic, hostel, and miscellaneous fees.
|
|
154
|
+
* @returns A promise resolving to StudentReceivable details.
|
|
155
|
+
*/
|
|
156
|
+
getStudentReceivable(): Promise<StudentReceivable>;
|
|
157
|
+
/**
|
|
158
|
+
* Fetches the student's schedule for a specific date.
|
|
159
|
+
* @param date - The date to fetch for (standard format).
|
|
160
|
+
* @returns A promise resolving to an array of TodaySchedule objects.
|
|
161
|
+
*/
|
|
162
|
+
getTodaySchedule(date: string): Promise<TodaySchedule[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Fetches the timetable entries between two dates.
|
|
165
|
+
* @param params - Date range and optional term filter.
|
|
166
|
+
* @returns A promise resolving to an array of DetailedTimetableEntry objects.
|
|
167
|
+
*/
|
|
168
|
+
getTimetableBetweenDates(params: {
|
|
169
|
+
startDate: string;
|
|
170
|
+
endDate: string;
|
|
171
|
+
termId?: number;
|
|
172
|
+
}): Promise<DetailedTimetableEntry[]>;
|
|
173
|
+
/**
|
|
174
|
+
* Performs a global search across student and faculty records.
|
|
175
|
+
* @param query - The search string (e.g., name or ID).
|
|
176
|
+
* @returns A promise resolving to an array of SearchResult objects.
|
|
177
|
+
*/
|
|
178
|
+
search(query: string): Promise<SearchResult[]>;
|
|
179
|
+
/**
|
|
180
|
+
* Retrieves the internal student ID from the current active session.
|
|
181
|
+
* @returns A promise resolving to the student ID.
|
|
182
|
+
*/
|
|
183
|
+
getStudentIdFromSession(): Promise<number>;
|
|
184
|
+
/**
|
|
185
|
+
* Fetches details of any course transfer requests made by the student.
|
|
186
|
+
* @returns A promise resolving to an object with transfer details.
|
|
187
|
+
*/
|
|
188
|
+
getTransferDetails(): Promise<{
|
|
189
|
+
hasTransferRequest: boolean;
|
|
190
|
+
studentTransferDetails: TransferDetail[];
|
|
191
|
+
}>;
|
|
192
|
+
/**
|
|
193
|
+
* Fetches the historical transfer record of the student.
|
|
194
|
+
* @returns A promise resolving to an array of TransferDetailsOfStudent objects.
|
|
195
|
+
*/
|
|
196
|
+
getTransferDetailsOfStudent(): Promise<TransferDetailsOfStudent[]>;
|
|
197
|
+
}
|
|
198
|
+
export * from './types';
|