mirror of
https://github.com/dd060606/WebAurion-API.git
synced 2026-01-18 16:47:26 +01:00
fix: npm link
This commit is contained in:
1358
package-lock.json
generated
1358
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "webaurion-api",
|
"name": "webaurion-api",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "./dist/index.js",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsup",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"lint": "eslint src --ext .ts"
|
"lint": "eslint src --ext .ts"
|
||||||
},
|
},
|
||||||
@@ -22,6 +24,10 @@
|
|||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
"tsup": "^8.3.5",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.6.3"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { getViewState } from "../utils/AurionUtils";
|
import { getViewState } from "../utils/AurionUtils";
|
||||||
import { getNotesFromResponse } from "../utils/NotesUtils";
|
import { getNotesFromResponse } from "../utils/NotesUtils";
|
||||||
|
import { NotesList } from "../utils/types";
|
||||||
import Session from "./Session";
|
import Session from "./Session";
|
||||||
|
|
||||||
class NotesApi {
|
class NotesApi {
|
||||||
@@ -20,6 +21,8 @@ class NotesApi {
|
|||||||
);
|
);
|
||||||
resolve(getNotesFromResponse(response));
|
resolve(getNotesFromResponse(response));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// En cas d'erreur, on supprime le cache de ViewState
|
||||||
|
this.session.clearViewStateCache();
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { getJSFFormParams, getViewState } from "../utils/AurionUtils";
|
import { getJSFFormParams, getViewState } from "../utils/AurionUtils";
|
||||||
import { planningResponseToEvents } from "../utils/PlanningUtils";
|
import { planningResponseToEvents } from "../utils/PlanningUtils";
|
||||||
|
import { PlanningEvent } from "../utils/types";
|
||||||
import Session from "./Session";
|
import Session from "./Session";
|
||||||
|
|
||||||
class PlanningApi {
|
class PlanningApi {
|
||||||
@@ -56,6 +57,8 @@ class PlanningApi {
|
|||||||
);
|
);
|
||||||
resolve(planningResponseToEvents(response));
|
resolve(planningResponseToEvents(response));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// En cas d'erreur, on supprime le cache de ViewState
|
||||||
|
this.session.clearViewStateCache();
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export { default as Session } from "./api/Session";
|
export * from "./api/Session";
|
||||||
export * from "./utils/AurionUtils";
|
export * from "./utils/AurionUtils";
|
||||||
export * from "./utils/NotesUtils";
|
export * from "./utils/NotesUtils";
|
||||||
export * from "./utils/PlanningUtils";
|
export * from "./utils/PlanningUtils";
|
||||||
|
export * from "./utils/types";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { load } from "cheerio";
|
import { load } from "cheerio";
|
||||||
|
import { Note, NotesList } from "./types";
|
||||||
|
|
||||||
export function getNotesFromResponse(htmlReponse: string): NotesList[] {
|
export function getNotesFromResponse(htmlReponse: string): NotesList[] {
|
||||||
// On parcourt le tableau des notes
|
// On parcourt le tableau des notes
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { load } from "cheerio";
|
import { load } from "cheerio";
|
||||||
|
import { PlanningEvent } from "./types";
|
||||||
|
|
||||||
// Conversion du calendrier au format JSON
|
// Conversion du calendrier au format JSON
|
||||||
export function getJSONSchedule(xml: string): object {
|
export function getJSONSchedule(xml: string): object {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
type PlanningEvent = {
|
export type PlanningEvent = {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
@@ -9,7 +9,7 @@ type PlanningEvent = {
|
|||||||
end: string;
|
end: string;
|
||||||
className: string;
|
className: string;
|
||||||
};
|
};
|
||||||
type Note = {
|
export type Note = {
|
||||||
date: string;
|
date: string;
|
||||||
code: string;
|
code: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
@@ -19,7 +19,7 @@ type Note = {
|
|||||||
instructor: string;
|
instructor: string;
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
type NotesList = {
|
export type NotesList = {
|
||||||
code: string;
|
code: string;
|
||||||
notes: Note[];
|
notes: Note[];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"module": "CommonJS",
|
"module": "ESNext",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|||||||
10
tsup.config.ts
Normal file
10
tsup.config.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { defineConfig } from "tsup";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
entry: ["src/index.ts"],
|
||||||
|
format: ["cjs", "esm"],
|
||||||
|
dts: true,
|
||||||
|
splitting: false,
|
||||||
|
sourcemap: true,
|
||||||
|
clean: true,
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user