init version
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
nkcs-engage.cookie.txt
|
||||
.env
|
||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM node:lts-alpine
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
RUN pnpm install --frozen-lockfile --prod
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["pnpm", "start"]
|
||||
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
## How to Run
|
||||
|
||||
copy `example.env`
|
||||
|
||||
```bash
|
||||
cp example.env .env
|
||||
```
|
||||
|
||||
edit `.env`
|
||||
|
||||
`API_USERNAME` is your engage username in URL-encode.
|
||||
`API_PASSWORD` is your engage password in URL-encode.
|
||||
11
docker-compose.yaml
Normal file
11
docker-compose.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
services:
|
||||
dsas-cca-backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: dsas-cca-backend
|
||||
ports:
|
||||
- "${PORT}:${PORT}"
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
306
engage-api/get-activity.mjs
Normal file
306
engage-api/get-activity.mjs
Normal file
@@ -0,0 +1,306 @@
|
||||
// get-activity.mjs
|
||||
|
||||
import axios from 'axios';
|
||||
import fs from 'fs/promises'; // Using fs.promises directly
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
// --- Replicating __dirname for ESM ---
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// --- Cookie Cache Configuration & In-Memory Cache ---
|
||||
const COOKIE_FILE_PATH = path.resolve(__dirname, 'nkcs-engage.cookie.txt');
|
||||
let _inMemoryCookie = null;
|
||||
|
||||
// --- Custom Error for Authentication ---
|
||||
class AuthenticationError extends Error {
|
||||
constructor(message = "Authentication failed, cookie may be invalid.", status) {
|
||||
super(message);
|
||||
this.name = "AuthenticationError";
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Cookie Cache Helper Functions ---
|
||||
async function loadCachedCookie() {
|
||||
if (_inMemoryCookie) {
|
||||
console.log("Using in-memory cached cookie.");
|
||||
return _inMemoryCookie;
|
||||
}
|
||||
try {
|
||||
const cookieFromFile = await fs.readFile(COOKIE_FILE_PATH, 'utf8');
|
||||
if (cookieFromFile) {
|
||||
_inMemoryCookie = cookieFromFile;
|
||||
console.log("Loaded cookie from file cache.");
|
||||
return _inMemoryCookie;
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
console.log("Cookie cache file not found. No cached cookie loaded.");
|
||||
} else {
|
||||
console.warn("Error loading cookie from file:", err.message);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function saveCookieToCache(cookieString) {
|
||||
if (!cookieString) {
|
||||
console.warn("Attempted to save an empty or null cookie. Aborting save.");
|
||||
return;
|
||||
}
|
||||
_inMemoryCookie = cookieString;
|
||||
try {
|
||||
await fs.writeFile(COOKIE_FILE_PATH, cookieString, 'utf8');
|
||||
console.log("Cookie saved to file cache.");
|
||||
} catch (err) {
|
||||
console.error("Error saving cookie to file:", err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function clearCookieCache() {
|
||||
_inMemoryCookie = null;
|
||||
try {
|
||||
await fs.unlink(COOKIE_FILE_PATH);
|
||||
console.log("Cookie cache file deleted.");
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
console.error("Error deleting cookie file:", err.message);
|
||||
} else {
|
||||
console.log("Cookie cache file did not exist, no need to delete.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function testCookieValidity(cookieString) {
|
||||
if (!cookieString) return false;
|
||||
console.log("Testing cookie validity...");
|
||||
try {
|
||||
const url = 'https://engage.nkcswx.cn/Services/ActivitiesService.asmx/GetActivityDetails';
|
||||
const headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Cookie': cookieString,
|
||||
'User-Agent': 'Mozilla/5.0 (Node.js DSAS-CCA get-activity Module)',
|
||||
};
|
||||
const payload = { "activityID": "3350" };
|
||||
await axios.post(url, payload, { headers, timeout: 10000 });
|
||||
console.log("Cookie test successful (API responded 2xx). Cookie is valid.");
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.warn("Cookie validity test failed.");
|
||||
if (error.response) {
|
||||
console.warn(`Cookie test API response status: ${error.response.status}. Cookie is likely invalid or expired.`);
|
||||
} else {
|
||||
console.warn(`Cookie test failed due to network or other error: ${error.message}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Core API Interaction Functions ---
|
||||
async function getSessionId() {
|
||||
const url = 'https://engage.nkcswx.cn/Login.aspx';
|
||||
try {
|
||||
const response = await axios.get(url, {
|
||||
headers: { 'User-Agent': 'Mozilla/5.0 (Node.js DSAS-CCA get-activity Module)' }
|
||||
});
|
||||
const setCookieHeader = response.headers['set-cookie'];
|
||||
if (setCookieHeader && setCookieHeader.length > 0) {
|
||||
const sessionIdCookie = setCookieHeader.find(cookie => cookie.trim().startsWith('ASP.NET_SessionId='));
|
||||
if (sessionIdCookie) {
|
||||
console.log('Debugging - ASP.NET_SessionId created');
|
||||
return sessionIdCookie.split(';')[0];
|
||||
}
|
||||
}
|
||||
console.error("No ASP.NET_SessionId cookie found in Set-Cookie header.");
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error(`Error in getSessionId: ${error.response ? `${error.response.status} - ${error.response.statusText}` : error.message}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function getMSAUTH(sessionId, userName, userPwd, templateFilePath) {
|
||||
const url = 'https://engage.nkcswx.cn/Login.aspx';
|
||||
try {
|
||||
let templateData = await fs.readFile(templateFilePath, 'utf8');
|
||||
const postData = templateData
|
||||
.replace('{{USERNAME}}', userName)
|
||||
.replace('{{PASSWORD}}', userPwd);
|
||||
const headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': sessionId,
|
||||
'User-Agent': 'Mozilla/5.0 (Node.js DSAS-CCA get-activity Module)',
|
||||
'Referer': 'https://engage.nkcswx.cn/Login.aspx'
|
||||
};
|
||||
console.log('Debugging - Getting .ASPXFORMSAUTH');
|
||||
const response = await axios.post(url, postData, {
|
||||
headers, maxRedirects: 0,
|
||||
validateStatus: (status) => status >= 200 && status < 400
|
||||
});
|
||||
const setCookieHeader = response.headers['set-cookie'];
|
||||
let formsAuthCookieValue = null;
|
||||
if (setCookieHeader && setCookieHeader.length > 0) {
|
||||
const aspxAuthCookies = setCookieHeader.filter(cookie => cookie.trim().startsWith('.ASPXFORMSAUTH='));
|
||||
if (aspxAuthCookies.length > 0) {
|
||||
for (let i = aspxAuthCookies.length - 1; i >= 0; i--) {
|
||||
const cookieCandidateParts = aspxAuthCookies[i].split(';');
|
||||
const firstPart = cookieCandidateParts[0].trim();
|
||||
if (firstPart.length > '.ASPXFORMSAUTH='.length && firstPart.substring('.ASPXFORMSAUTH='.length).length > 0) {
|
||||
formsAuthCookieValue = firstPart; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (formsAuthCookieValue) {
|
||||
console.log('Debugging - .ASPXFORMSAUTH cookie obtained.');
|
||||
return formsAuthCookieValue;
|
||||
} else {
|
||||
console.error("No valid .ASPXFORMSAUTH cookie found. Headers:", setCookieHeader || "none");
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') console.error(`Error: Template file '${templateFilePath}' not found.`);
|
||||
else console.error(`Error in getMSAUTH: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function getCompleteCookies(userName, userPwd, templateFilePath) {
|
||||
console.log('Debugging - Attempting to get complete cookie string (login process).');
|
||||
const sessionId = await getSessionId();
|
||||
if (!sessionId) throw new Error("Login failed: Could not obtain ASP.NET_SessionId.");
|
||||
|
||||
const msAuth = await getMSAUTH(sessionId, userName, userPwd, templateFilePath);
|
||||
if (!msAuth) throw new Error("Login failed: Could not obtain .ASPXFORMSAUTH cookie.");
|
||||
|
||||
return `${sessionId}; ${msAuth}`;
|
||||
}
|
||||
|
||||
async function getActivityDetailsRaw(activityId, cookies, maxRetries = 3, timeoutMilliseconds = 20000) {
|
||||
const url = 'https://engage.nkcswx.cn/Services/ActivitiesService.asmx/GetActivityDetails';
|
||||
const headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8', 'Cookie': cookies,
|
||||
'User-Agent': 'Mozilla/5.0 (Node.js DSAS-CCA get-activity Module)',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
};
|
||||
const payload = { "activityID": String(activityId) };
|
||||
|
||||
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
||||
try {
|
||||
const response = await axios.post(url, payload, {
|
||||
headers, timeout: timeoutMilliseconds, responseType: 'text'
|
||||
});
|
||||
const outerData = JSON.parse(response.data);
|
||||
if (outerData && typeof outerData.d === 'string') {
|
||||
const innerData = JSON.parse(outerData.d);
|
||||
if (innerData.isError) {
|
||||
console.warn(`API reported isError:true for activity ${activityId}.`);
|
||||
return null;
|
||||
}
|
||||
return response.data;
|
||||
} else {
|
||||
console.error(`Unexpected API response structure for activity ${activityId}.`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.response && (error.response.status === 403 || error.response.status === 401)) {
|
||||
console.warn(`Authentication error (${error.response.status}) while fetching activity ${activityId}. Cookie may be invalid.`);
|
||||
throw new AuthenticationError(`Received ${error.response.status} for activity ${activityId}`, error.response.status);
|
||||
}
|
||||
console.error(`Attempt ${attempt + 1}/${maxRetries} for activity ${activityId} failed: ${error.message}`);
|
||||
if (error.response) {
|
||||
console.error(`Status: ${error.response.status}, Data (getActivityDetailsRaw): ${ String(error.response.data).slice(0,100)}...`);
|
||||
}
|
||||
if (attempt === maxRetries - 1) {
|
||||
console.error(`All ${maxRetries} retries failed for activity ${activityId}.`);
|
||||
throw error;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main exported function. Handles cookie caching, validation, re-authentication, and fetches activity details.
|
||||
* @param {string} activityId - The ID of the activity to fetch.
|
||||
* @param {string} userName - URL-encoded username.
|
||||
* @param {string} userPwd - URL-encoded password.
|
||||
* @param {string} [templateFileName="login_template.txt"] - Name of the login template file.
|
||||
* @param {boolean} [forceLogin=false] - If true, bypasses cached cookie and forces a new login.
|
||||
* @returns {Promise<object|null>} The parsed JSON object of activity details, or null on failure.
|
||||
*/
|
||||
export async function fetchActivityData(activityId, userName, userPwd, templateFileName = "login_template.txt", forceLogin = false) {
|
||||
let currentCookie = forceLogin ? null : await loadCachedCookie();
|
||||
|
||||
if (forceLogin && currentCookie) {
|
||||
await clearCookieCache();
|
||||
currentCookie = null;
|
||||
}
|
||||
|
||||
if (currentCookie) {
|
||||
const isValid = await testCookieValidity(currentCookie);
|
||||
if (!isValid) {
|
||||
console.log("Cached cookie test failed or cookie expired. Clearing cache.");
|
||||
await clearCookieCache();
|
||||
currentCookie = null;
|
||||
} else {
|
||||
console.log("Using valid cached cookie.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentCookie) {
|
||||
console.log(forceLogin ? "Forcing new login." : "No valid cached cookie found or cache bypassed. Attempting login...");
|
||||
try {
|
||||
currentCookie = await getCompleteCookies(userName, userPwd, path.resolve(__dirname, templateFileName));
|
||||
await saveCookieToCache(currentCookie);
|
||||
} catch (loginError) {
|
||||
console.error(`Login process failed: ${loginError.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentCookie) {
|
||||
console.error("Critical: No cookie available after login attempt. Cannot fetch activity data.");
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const rawActivityDetailsString = await getActivityDetailsRaw(activityId, currentCookie);
|
||||
if (rawActivityDetailsString) {
|
||||
const parsedOuter = JSON.parse(rawActivityDetailsString);
|
||||
return JSON.parse(parsedOuter.d);
|
||||
}
|
||||
console.warn(`No data returned from getActivityDetailsRaw for activity ${activityId}, but no authentication error was thrown.`);
|
||||
return null;
|
||||
} catch (error) {
|
||||
if (error instanceof AuthenticationError) {
|
||||
console.warn(`Initial fetch failed with AuthenticationError (Status: ${error.status}). Cookie was likely invalid. Attempting re-login and one retry.`);
|
||||
await clearCookieCache();
|
||||
|
||||
try {
|
||||
console.log("Attempting re-login due to authentication failure...");
|
||||
currentCookie = await getCompleteCookies(userName, userPwd, path.resolve(__dirname, templateFileName));
|
||||
await saveCookieToCache(currentCookie);
|
||||
|
||||
console.log("Re-login successful. Retrying request for activity details once...");
|
||||
const rawActivityDetailsStringRetry = await getActivityDetailsRaw(activityId, currentCookie);
|
||||
if (rawActivityDetailsStringRetry) {
|
||||
const parsedOuterRetry = JSON.parse(rawActivityDetailsStringRetry);
|
||||
return JSON.parse(parsedOuterRetry.d);
|
||||
}
|
||||
console.warn(`Still no details for activity ${activityId} after re-login and retry.`);
|
||||
return null;
|
||||
} catch (retryLoginOrFetchError) {
|
||||
console.error(`Error during re-login or retry fetch for activity ${activityId}: ${retryLoginOrFetchError.message}`);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
console.error(`Failed to fetch activity data for ${activityId} due to non-authentication error: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Optionally export other functions if they are meant to be used externally
|
||||
export { clearCookieCache, testCookieValidity };
|
||||
1
engage-api/login_template.txt
Normal file
1
engage-api/login_template.txt
Normal file
File diff suppressed because one or more lines are too long
151
engage-api/struct-activity.mjs
Normal file
151
engage-api/struct-activity.mjs
Normal file
@@ -0,0 +1,151 @@
|
||||
// struct-activity.mjs
|
||||
|
||||
let clubSchema = {
|
||||
academicYear: null,
|
||||
category: null,
|
||||
description: null,
|
||||
duration: {
|
||||
endDate: null,
|
||||
isRecurringWeekly: null,
|
||||
startDate: null
|
||||
},
|
||||
grades: {
|
||||
max: null,
|
||||
min: null
|
||||
},
|
||||
id: null,
|
||||
isPreSignup: null,
|
||||
isStudentLed: null,
|
||||
materials: [],
|
||||
meeting: {
|
||||
day: null,
|
||||
endTime: null,
|
||||
location: {
|
||||
block: null,
|
||||
room: null,
|
||||
site: null
|
||||
},
|
||||
startTime: null
|
||||
},
|
||||
name: null,
|
||||
photo: null,
|
||||
poorWeatherPlan: null,
|
||||
requirements: [],
|
||||
schedule: null,
|
||||
semesterCost: null,
|
||||
staff: [],
|
||||
staffForReports: [],
|
||||
studentLeaders: []
|
||||
}
|
||||
|
||||
async function applyFields(field, structuredActivityData) {
|
||||
switch (true) {
|
||||
case field.fID == "academicyear":
|
||||
structuredActivityData.academicYear = field.fData;
|
||||
break;
|
||||
case field.fID == "schedule":
|
||||
structuredActivityData.schedule = field.fData;
|
||||
break;
|
||||
case field.fID == "category":
|
||||
structuredActivityData.category = field.fData;
|
||||
break;
|
||||
case field.fID == "activityname":
|
||||
structuredActivityData.name = field.fData;
|
||||
break;
|
||||
case field.fID == "day":
|
||||
structuredActivityData.meeting.day = field.fData;
|
||||
break;
|
||||
case field.fID == "start":
|
||||
structuredActivityData.meeting.startTime = field.fData;
|
||||
break;
|
||||
case field.fID == "end":
|
||||
structuredActivityData.meeting.endTime = field.fData;
|
||||
break;
|
||||
case field.fID == "site":
|
||||
structuredActivityData.meeting.location.site = field.fData;
|
||||
break;
|
||||
case field.fID == "block":
|
||||
structuredActivityData.meeting.location.block = field.fData;
|
||||
break;
|
||||
case field.fID == "room":
|
||||
structuredActivityData.meeting.location.room = field.fData;
|
||||
break;
|
||||
case field.fID == "staff":
|
||||
let staff = field.fData.split(", ");
|
||||
structuredActivityData.staff = staff;
|
||||
break;
|
||||
case field.fID == "runsfrom":
|
||||
structuredActivityData.duration.startDate = field.fData;
|
||||
break;
|
||||
case field.fID == "runsto":
|
||||
structuredActivityData.duration.endDate = field.fData;
|
||||
break;
|
||||
case field.fData == "Recurring Weekly":
|
||||
structuredActivityData.duration.isRecurringWeekly = true;
|
||||
break;
|
||||
default:
|
||||
//console.log(`No matching case for field: fID=${field.fID}, fType=${field.fType}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function postProcess(structuredActivityData) {
|
||||
structuredActivityData.description = structuredActivityData.description.replaceAll("<br/>","\n");
|
||||
if (structuredActivityData.name.search("Student-led") != -1) {
|
||||
structuredActivityData.isStudentLed = true;
|
||||
} else {
|
||||
structuredActivityData.isStudentLed = false;
|
||||
}
|
||||
const grades = structuredActivityData.schedule.match(/G(\d+)-(\d+)/);
|
||||
structuredActivityData.grades.min = grades[1];
|
||||
structuredActivityData.grades.max = grades[2];
|
||||
}
|
||||
|
||||
export async function structActivityData(rawActivityData) {
|
||||
let structuredActivityData = JSON.parse(JSON.stringify(clubSchema));
|
||||
let rows = rawActivityData.newRows;
|
||||
// Load club id - "rID": "3350:1:0:0"
|
||||
structuredActivityData.id = rows[0].rID.split(":")[0];
|
||||
for (const rowObject of rows) {
|
||||
for (let i = 0; i < rowObject.fields.length; i++) {
|
||||
const field = rowObject.fields[i];
|
||||
// Optimize: no fData, just skip
|
||||
if (field.fData == null && field.fData == "") { continue; }
|
||||
// Process hard cases first
|
||||
if (field.fData == "Description") {
|
||||
structuredActivityData.description = rowObject.fields[i + 1].fData;
|
||||
continue;
|
||||
} else if (field.fData == "Name To Appear On Reports"){
|
||||
let staffForReports = rowObject.fields[i + 1].fData.split(", ");
|
||||
structuredActivityData.staffForReports = staffForReports;
|
||||
} else if (field.fData == "Upload Photo") {
|
||||
structuredActivityData.photo = rowObject.fields[i + 1].fData;
|
||||
} else if (field.fData == "Poor Weather Plan") {
|
||||
structuredActivityData.poorWeatherPlan = rowObject.fields[i + 1].fData;
|
||||
} else if (field.fData == "Activity Runs From") {
|
||||
if (rowObject.fields[i + 4].fData == "Recurring Weekly") {
|
||||
structuredActivityData.duration.isRecurringWeekly = true;
|
||||
} else {
|
||||
structuredActivityData.duration.isRecurringWeekly = false;
|
||||
}
|
||||
} else if (field.fData == "Is Pre Sign-up") {
|
||||
if (rowObject.fields[i + 1].fData == "") {
|
||||
structuredActivityData.isPreSignup = false;
|
||||
} else {
|
||||
structuredActivityData.isPreSignup = true;
|
||||
}
|
||||
} else if (field.fData == "Semester Cost") {
|
||||
if (rowObject.fields[i + 1].fData == "") {
|
||||
structuredActivityData.semesterCost = null;
|
||||
} else {
|
||||
structuredActivityData.semesterCost = rowObject.fields[i + 1].fData
|
||||
}
|
||||
} else {
|
||||
// Pass any other easy cases to helper function
|
||||
applyFields(field, structuredActivityData);
|
||||
}
|
||||
}
|
||||
}
|
||||
postProcess(structuredActivityData);
|
||||
return structuredActivityData
|
||||
}
|
||||
21
engage-api/struct-staff.mjs
Normal file
21
engage-api/struct-staff.mjs
Normal file
@@ -0,0 +1,21 @@
|
||||
// struct-staff.mjs
|
||||
|
||||
let staffs = new Map();
|
||||
|
||||
async function updateStaffMap(staffs,lParms) {
|
||||
for (const staff of lParms) {
|
||||
staffs.set(staff.key, staff.val)
|
||||
}
|
||||
}
|
||||
|
||||
export async function structStaffData(rawActivityData) {
|
||||
let rows = rawActivityData.newRows;
|
||||
for (const rowObject of rows) {
|
||||
for (const field of rowObject.fields) {
|
||||
if (field.fID == "staff") {
|
||||
await updateStaffMap(staffs, field.lParms);
|
||||
return staffs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
4
example.env
Normal file
4
example.env
Normal file
@@ -0,0 +1,4 @@
|
||||
API_USERNAME=
|
||||
API_PASSWORD=
|
||||
PORT=3000
|
||||
FIXED_STAFF_ACTIVITY_ID=7095
|
||||
105
main.js
Normal file
105
main.js
Normal file
@@ -0,0 +1,105 @@
|
||||
// main.js
|
||||
import express from 'express';
|
||||
import dotenv from 'dotenv';
|
||||
import { fetchActivityData } from './engage-api/get-activity.mjs';
|
||||
import { structActivityData } from './engage-api/struct-activity.mjs';
|
||||
import { structStaffData } from './engage-api/struct-staff.mjs';
|
||||
|
||||
// Load environment variables from .env file
|
||||
dotenv.config();
|
||||
|
||||
// --- Configuration ---
|
||||
const USERNAME = process.env.API_USERNAME;
|
||||
const PASSWORD = process.env.API_PASSWORD;
|
||||
const PORT = process.env.PORT || 3000; // Default to port 3000 if not specified
|
||||
const FIXED_STAFF_ACTIVITY_ID = process.env.FIXED_STAFF_ACTIVITY_ID || '3350';
|
||||
|
||||
// --- Initialize Express App ---
|
||||
const app = express();
|
||||
|
||||
// Middleware to parse JSON request bodies (useful if you add POST/PUT later)
|
||||
app.use(express.json());
|
||||
|
||||
// --- API Endpoints ---
|
||||
|
||||
// GET Endpoint: Welcome message
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Welcome to the DSAS CCA API!<br/><br/>\
|
||||
API Endpoints:<br/>\
|
||||
GET /v1/activity/:activityId (ID must be 1-4 digits)<br/>\
|
||||
GET /v1/staffs');
|
||||
});
|
||||
|
||||
// GET Endpoint: Fetch structured activity data by ID
|
||||
app.get('/v1/activity/:activityId', async (req, res) => {
|
||||
let { activityId } = req.params; // Extract activityId from URL parameter
|
||||
|
||||
// Validate activityId: should be 1 to 4 digits
|
||||
if (!/^\d{1,4}$/.test(activityId)) {
|
||||
return res.status(400).json({
|
||||
error: 'Invalid Activity ID format. Activity ID must be 1 to 4 digits (e.g., 1, 0001, 9999).'
|
||||
});
|
||||
}
|
||||
|
||||
if (!USERNAME || !PASSWORD) {
|
||||
console.error('API username or password not configured. Check .env file or environment variables.');
|
||||
return res.status(500).json({ error: 'Server configuration error.' });
|
||||
}
|
||||
|
||||
console.log(`Workspaceing activity details for activity ID: ${activityId}`);
|
||||
try {
|
||||
const activityJson = await fetchActivityData(activityId, USERNAME, PASSWORD);
|
||||
if (activityJson) {
|
||||
const structuredActivity = await structActivityData(activityJson);
|
||||
res.json(structuredActivity); // Assuming structActivityData returns a JSON-friendly object
|
||||
} else {
|
||||
res.status(404).json({ error: `Could not retrieve details for activity ${activityId}.` });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching activity ${activityId}:`, error);
|
||||
res.status(500).json({ error: 'An internal server error occurred while fetching activity data.' });
|
||||
}
|
||||
});
|
||||
|
||||
// GET Endpoint: Fetch fixed structured staff data
|
||||
app.get('/v1/staffs', async (req, res) => {
|
||||
if (!USERNAME || !PASSWORD) {
|
||||
console.error('API username or password not configured. Check .env file or environment variables.');
|
||||
return res.status(500).json({ error: 'Server configuration error.' });
|
||||
}
|
||||
|
||||
console.log(`Workspaceing staff details (using fixed activity ID: ${FIXED_STAFF_ACTIVITY_ID})`);
|
||||
try {
|
||||
const activityJson = await fetchActivityData(FIXED_STAFF_ACTIVITY_ID, USERNAME, PASSWORD);
|
||||
if (activityJson) {
|
||||
const staffMap = await structStaffData(activityJson); // This returns a Map
|
||||
|
||||
// Convert Map to a plain object for JSON serialization
|
||||
const staffObject = Object.fromEntries(staffMap);
|
||||
res.json(staffObject);
|
||||
} else {
|
||||
res.status(404).json({ error: `Could not retrieve base data using activity ID ${FIXED_STAFF_ACTIVITY_ID} to get staff details.` });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching staff data (for fixed activity ID ${FIXED_STAFF_ACTIVITY_ID}):`, error);
|
||||
res.status(500).json({ error: 'An internal server error occurred while fetching staff data.' });
|
||||
}
|
||||
});
|
||||
|
||||
// --- Start the Server ---
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on http://localhost:${PORT}`);
|
||||
console.log('API Endpoints:');
|
||||
console.log(` GET /v1/activity/:activityId (ID must be 1-4 digits)`);
|
||||
console.log(` GET /v1/staffs`);
|
||||
if (!USERNAME || !PASSWORD) {
|
||||
console.warn('Warning: API_USERNAME or API_PASSWORD is not set. Please configure them in your .env file or environment variables.');
|
||||
}
|
||||
});
|
||||
|
||||
// Graceful shutdown (optional but good practice)
|
||||
process.on('SIGINT', () => {
|
||||
console.log('Server shutting down...');
|
||||
// Perform any cleanup here
|
||||
process.exit(0);
|
||||
});
|
||||
18
package.json
Normal file
18
package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "dsas-cca-backend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "main.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node main.js",
|
||||
"dev": "node --watch main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.9.0",
|
||||
"dotenv": "^16.5.0",
|
||||
"express": "^5.1.0",
|
||||
"node-fetch": "^3.3.2"
|
||||
},
|
||||
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
||||
}
|
||||
721
pnpm-lock.yaml
generated
Normal file
721
pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,721 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
axios:
|
||||
specifier: ^1.9.0
|
||||
version: 1.9.0
|
||||
dotenv:
|
||||
specifier: ^16.5.0
|
||||
version: 16.5.0
|
||||
express:
|
||||
specifier: ^5.1.0
|
||||
version: 5.1.0
|
||||
node-fetch:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
|
||||
packages:
|
||||
|
||||
accepts@2.0.0:
|
||||
resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
asynckit@0.4.0:
|
||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||
|
||||
axios@1.9.0:
|
||||
resolution: {integrity: sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==}
|
||||
|
||||
body-parser@2.2.0:
|
||||
resolution: {integrity: sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
bytes@3.1.2:
|
||||
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
call-bind-apply-helpers@1.0.2:
|
||||
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
call-bound@1.0.4:
|
||||
resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
combined-stream@1.0.8:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
content-disposition@1.0.0:
|
||||
resolution: {integrity: sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
content-type@1.0.5:
|
||||
resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
cookie-signature@1.2.2:
|
||||
resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}
|
||||
engines: {node: '>=6.6.0'}
|
||||
|
||||
cookie@0.7.2:
|
||||
resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
data-uri-to-buffer@4.0.1:
|
||||
resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
|
||||
engines: {node: '>= 12'}
|
||||
|
||||
debug@4.4.0:
|
||||
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
|
||||
delayed-stream@1.0.0:
|
||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
|
||||
depd@2.0.0:
|
||||
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
dotenv@16.5.0:
|
||||
resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
ee-first@1.1.1:
|
||||
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
|
||||
|
||||
encodeurl@2.0.0:
|
||||
resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
es-define-property@1.0.1:
|
||||
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-errors@1.3.0:
|
||||
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-object-atoms@1.1.1:
|
||||
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-set-tostringtag@2.1.0:
|
||||
resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
escape-html@1.0.3:
|
||||
resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
|
||||
|
||||
etag@1.8.1:
|
||||
resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
express@5.1.0:
|
||||
resolution: {integrity: sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==}
|
||||
engines: {node: '>= 18'}
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}
|
||||
engines: {node: ^12.20 || >= 14.13}
|
||||
|
||||
finalhandler@2.1.0:
|
||||
resolution: {integrity: sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
follow-redirects@1.15.9:
|
||||
resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
peerDependenciesMeta:
|
||||
debug:
|
||||
optional: true
|
||||
|
||||
form-data@4.0.2:
|
||||
resolution: {integrity: sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
formdata-polyfill@4.0.10:
|
||||
resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
|
||||
forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
fresh@2.0.0:
|
||||
resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
function-bind@1.1.2:
|
||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||
|
||||
get-intrinsic@1.3.0:
|
||||
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
get-proto@1.0.1:
|
||||
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
gopd@1.2.0:
|
||||
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
has-symbols@1.1.0:
|
||||
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
has-tostringtag@1.0.2:
|
||||
resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
hasown@2.0.2:
|
||||
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
http-errors@2.0.0:
|
||||
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
iconv-lite@0.6.3:
|
||||
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
inherits@2.0.4:
|
||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
||||
|
||||
ipaddr.js@1.9.1:
|
||||
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
is-promise@4.0.0:
|
||||
resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
|
||||
|
||||
math-intrinsics@1.1.0:
|
||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
media-typer@1.1.0:
|
||||
resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
merge-descriptors@2.0.0:
|
||||
resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
mime-db@1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-db@1.54.0:
|
||||
resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@3.0.1:
|
||||
resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
|
||||
negotiator@1.0.0:
|
||||
resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
node-domexception@1.0.0:
|
||||
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
||||
engines: {node: '>=10.5.0'}
|
||||
deprecated: Use your platform's native DOMException instead
|
||||
|
||||
node-fetch@3.3.2:
|
||||
resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
|
||||
object-inspect@1.13.4:
|
||||
resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
on-finished@2.4.1:
|
||||
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
once@1.4.0:
|
||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||
|
||||
parseurl@1.3.3:
|
||||
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
path-to-regexp@8.2.0:
|
||||
resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
proxy-addr@2.0.7:
|
||||
resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
proxy-from-env@1.1.0:
|
||||
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
|
||||
|
||||
qs@6.14.0:
|
||||
resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
|
||||
engines: {node: '>=0.6'}
|
||||
|
||||
range-parser@1.2.1:
|
||||
resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
raw-body@3.0.0:
|
||||
resolution: {integrity: sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
router@2.2.0:
|
||||
resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
|
||||
engines: {node: '>= 18'}
|
||||
|
||||
safe-buffer@5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
|
||||
safer-buffer@2.1.2:
|
||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||
|
||||
send@1.2.0:
|
||||
resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}
|
||||
engines: {node: '>= 18'}
|
||||
|
||||
serve-static@2.2.0:
|
||||
resolution: {integrity: sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==}
|
||||
engines: {node: '>= 18'}
|
||||
|
||||
setprototypeof@1.2.0:
|
||||
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
|
||||
|
||||
side-channel-list@1.0.0:
|
||||
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
side-channel-map@1.0.1:
|
||||
resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
side-channel-weakmap@1.0.2:
|
||||
resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
side-channel@1.1.0:
|
||||
resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
statuses@2.0.1:
|
||||
resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
toidentifier@1.0.1:
|
||||
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
|
||||
engines: {node: '>=0.6'}
|
||||
|
||||
type-is@2.0.1:
|
||||
resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
unpipe@1.0.0:
|
||||
resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
vary@1.1.2:
|
||||
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
web-streams-polyfill@3.3.3:
|
||||
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
wrappy@1.0.2:
|
||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
accepts@2.0.0:
|
||||
dependencies:
|
||||
mime-types: 3.0.1
|
||||
negotiator: 1.0.0
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
||||
axios@1.9.0:
|
||||
dependencies:
|
||||
follow-redirects: 1.15.9
|
||||
form-data: 4.0.2
|
||||
proxy-from-env: 1.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
body-parser@2.2.0:
|
||||
dependencies:
|
||||
bytes: 3.1.2
|
||||
content-type: 1.0.5
|
||||
debug: 4.4.0
|
||||
http-errors: 2.0.0
|
||||
iconv-lite: 0.6.3
|
||||
on-finished: 2.4.1
|
||||
qs: 6.14.0
|
||||
raw-body: 3.0.0
|
||||
type-is: 2.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
bytes@3.1.2: {}
|
||||
|
||||
call-bind-apply-helpers@1.0.2:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
function-bind: 1.1.2
|
||||
|
||||
call-bound@1.0.4:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
get-intrinsic: 1.3.0
|
||||
|
||||
combined-stream@1.0.8:
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
|
||||
content-disposition@1.0.0:
|
||||
dependencies:
|
||||
safe-buffer: 5.2.1
|
||||
|
||||
content-type@1.0.5: {}
|
||||
|
||||
cookie-signature@1.2.2: {}
|
||||
|
||||
cookie@0.7.2: {}
|
||||
|
||||
data-uri-to-buffer@4.0.1: {}
|
||||
|
||||
debug@4.4.0:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
delayed-stream@1.0.0: {}
|
||||
|
||||
depd@2.0.0: {}
|
||||
|
||||
dotenv@16.5.0: {}
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
es-errors: 1.3.0
|
||||
gopd: 1.2.0
|
||||
|
||||
ee-first@1.1.1: {}
|
||||
|
||||
encodeurl@2.0.0: {}
|
||||
|
||||
es-define-property@1.0.1: {}
|
||||
|
||||
es-errors@1.3.0: {}
|
||||
|
||||
es-object-atoms@1.1.1:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
|
||||
es-set-tostringtag@2.1.0:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.3.0
|
||||
has-tostringtag: 1.0.2
|
||||
hasown: 2.0.2
|
||||
|
||||
escape-html@1.0.3: {}
|
||||
|
||||
etag@1.8.1: {}
|
||||
|
||||
express@5.1.0:
|
||||
dependencies:
|
||||
accepts: 2.0.0
|
||||
body-parser: 2.2.0
|
||||
content-disposition: 1.0.0
|
||||
content-type: 1.0.5
|
||||
cookie: 0.7.2
|
||||
cookie-signature: 1.2.2
|
||||
debug: 4.4.0
|
||||
encodeurl: 2.0.0
|
||||
escape-html: 1.0.3
|
||||
etag: 1.8.1
|
||||
finalhandler: 2.1.0
|
||||
fresh: 2.0.0
|
||||
http-errors: 2.0.0
|
||||
merge-descriptors: 2.0.0
|
||||
mime-types: 3.0.1
|
||||
on-finished: 2.4.1
|
||||
once: 1.4.0
|
||||
parseurl: 1.3.3
|
||||
proxy-addr: 2.0.7
|
||||
qs: 6.14.0
|
||||
range-parser: 1.2.1
|
||||
router: 2.2.0
|
||||
send: 1.2.0
|
||||
serve-static: 2.2.0
|
||||
statuses: 2.0.1
|
||||
type-is: 2.0.1
|
||||
vary: 1.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
dependencies:
|
||||
node-domexception: 1.0.0
|
||||
web-streams-polyfill: 3.3.3
|
||||
|
||||
finalhandler@2.1.0:
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
encodeurl: 2.0.0
|
||||
escape-html: 1.0.3
|
||||
on-finished: 2.4.1
|
||||
parseurl: 1.3.3
|
||||
statuses: 2.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
follow-redirects@1.15.9: {}
|
||||
|
||||
form-data@4.0.2:
|
||||
dependencies:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
es-set-tostringtag: 2.1.0
|
||||
mime-types: 2.1.35
|
||||
|
||||
formdata-polyfill@4.0.10:
|
||||
dependencies:
|
||||
fetch-blob: 3.2.0
|
||||
|
||||
forwarded@0.2.0: {}
|
||||
|
||||
fresh@2.0.0: {}
|
||||
|
||||
function-bind@1.1.2: {}
|
||||
|
||||
get-intrinsic@1.3.0:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
es-define-property: 1.0.1
|
||||
es-errors: 1.3.0
|
||||
es-object-atoms: 1.1.1
|
||||
function-bind: 1.1.2
|
||||
get-proto: 1.0.1
|
||||
gopd: 1.2.0
|
||||
has-symbols: 1.1.0
|
||||
hasown: 2.0.2
|
||||
math-intrinsics: 1.1.0
|
||||
|
||||
get-proto@1.0.1:
|
||||
dependencies:
|
||||
dunder-proto: 1.0.1
|
||||
es-object-atoms: 1.1.1
|
||||
|
||||
gopd@1.2.0: {}
|
||||
|
||||
has-symbols@1.1.0: {}
|
||||
|
||||
has-tostringtag@1.0.2:
|
||||
dependencies:
|
||||
has-symbols: 1.1.0
|
||||
|
||||
hasown@2.0.2:
|
||||
dependencies:
|
||||
function-bind: 1.1.2
|
||||
|
||||
http-errors@2.0.0:
|
||||
dependencies:
|
||||
depd: 2.0.0
|
||||
inherits: 2.0.4
|
||||
setprototypeof: 1.2.0
|
||||
statuses: 2.0.1
|
||||
toidentifier: 1.0.1
|
||||
|
||||
iconv-lite@0.6.3:
|
||||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
inherits@2.0.4: {}
|
||||
|
||||
ipaddr.js@1.9.1: {}
|
||||
|
||||
is-promise@4.0.0: {}
|
||||
|
||||
math-intrinsics@1.1.0: {}
|
||||
|
||||
media-typer@1.1.0: {}
|
||||
|
||||
merge-descriptors@2.0.0: {}
|
||||
|
||||
mime-db@1.52.0: {}
|
||||
|
||||
mime-db@1.54.0: {}
|
||||
|
||||
mime-types@2.1.35:
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
|
||||
mime-types@3.0.1:
|
||||
dependencies:
|
||||
mime-db: 1.54.0
|
||||
|
||||
ms@2.1.3: {}
|
||||
|
||||
negotiator@1.0.0: {}
|
||||
|
||||
node-domexception@1.0.0: {}
|
||||
|
||||
node-fetch@3.3.2:
|
||||
dependencies:
|
||||
data-uri-to-buffer: 4.0.1
|
||||
fetch-blob: 3.2.0
|
||||
formdata-polyfill: 4.0.10
|
||||
|
||||
object-inspect@1.13.4: {}
|
||||
|
||||
on-finished@2.4.1:
|
||||
dependencies:
|
||||
ee-first: 1.1.1
|
||||
|
||||
once@1.4.0:
|
||||
dependencies:
|
||||
wrappy: 1.0.2
|
||||
|
||||
parseurl@1.3.3: {}
|
||||
|
||||
path-to-regexp@8.2.0: {}
|
||||
|
||||
proxy-addr@2.0.7:
|
||||
dependencies:
|
||||
forwarded: 0.2.0
|
||||
ipaddr.js: 1.9.1
|
||||
|
||||
proxy-from-env@1.1.0: {}
|
||||
|
||||
qs@6.14.0:
|
||||
dependencies:
|
||||
side-channel: 1.1.0
|
||||
|
||||
range-parser@1.2.1: {}
|
||||
|
||||
raw-body@3.0.0:
|
||||
dependencies:
|
||||
bytes: 3.1.2
|
||||
http-errors: 2.0.0
|
||||
iconv-lite: 0.6.3
|
||||
unpipe: 1.0.0
|
||||
|
||||
router@2.2.0:
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
depd: 2.0.0
|
||||
is-promise: 4.0.0
|
||||
parseurl: 1.3.3
|
||||
path-to-regexp: 8.2.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
safe-buffer@5.2.1: {}
|
||||
|
||||
safer-buffer@2.1.2: {}
|
||||
|
||||
send@1.2.0:
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
encodeurl: 2.0.0
|
||||
escape-html: 1.0.3
|
||||
etag: 1.8.1
|
||||
fresh: 2.0.0
|
||||
http-errors: 2.0.0
|
||||
mime-types: 3.0.1
|
||||
ms: 2.1.3
|
||||
on-finished: 2.4.1
|
||||
range-parser: 1.2.1
|
||||
statuses: 2.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
serve-static@2.2.0:
|
||||
dependencies:
|
||||
encodeurl: 2.0.0
|
||||
escape-html: 1.0.3
|
||||
parseurl: 1.3.3
|
||||
send: 1.2.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
setprototypeof@1.2.0: {}
|
||||
|
||||
side-channel-list@1.0.0:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
object-inspect: 1.13.4
|
||||
|
||||
side-channel-map@1.0.1:
|
||||
dependencies:
|
||||
call-bound: 1.0.4
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.3.0
|
||||
object-inspect: 1.13.4
|
||||
|
||||
side-channel-weakmap@1.0.2:
|
||||
dependencies:
|
||||
call-bound: 1.0.4
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.3.0
|
||||
object-inspect: 1.13.4
|
||||
side-channel-map: 1.0.1
|
||||
|
||||
side-channel@1.1.0:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
object-inspect: 1.13.4
|
||||
side-channel-list: 1.0.0
|
||||
side-channel-map: 1.0.1
|
||||
side-channel-weakmap: 1.0.2
|
||||
|
||||
statuses@2.0.1: {}
|
||||
|
||||
toidentifier@1.0.1: {}
|
||||
|
||||
type-is@2.0.1:
|
||||
dependencies:
|
||||
content-type: 1.0.5
|
||||
media-typer: 1.1.0
|
||||
mime-types: 3.0.1
|
||||
|
||||
unpipe@1.0.0: {}
|
||||
|
||||
vary@1.1.2: {}
|
||||
|
||||
web-streams-polyfill@3.3.3: {}
|
||||
|
||||
wrappy@1.0.2: {}
|
||||
Reference in New Issue
Block a user