fix: npm link

This commit is contained in:
dd060606
2024-11-23 10:44:34 +01:00
parent 0f1df15630
commit d7e807d04d
10 changed files with 1391 additions and 8 deletions

1358
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,11 @@
{
"name": "webaurion-api",
"version": "1.0.0",
"main": "index.js",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"build": "tsup",
"test": "jest",
"lint": "eslint src --ext .ts"
},
@@ -22,6 +24,10 @@
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsup": "^8.3.5",
"typescript": "^5.6.3"
}
},
"files": [
"dist/**/*"
]
}

View File

@@ -1,5 +1,6 @@
import { getViewState } from "../utils/AurionUtils";
import { getNotesFromResponse } from "../utils/NotesUtils";
import { NotesList } from "../utils/types";
import Session from "./Session";
class NotesApi {
@@ -20,6 +21,8 @@ class NotesApi {
);
resolve(getNotesFromResponse(response));
} catch (error) {
// En cas d'erreur, on supprime le cache de ViewState
this.session.clearViewStateCache();
reject(error);
}
});

View File

@@ -1,5 +1,6 @@
import { getJSFFormParams, getViewState } from "../utils/AurionUtils";
import { planningResponseToEvents } from "../utils/PlanningUtils";
import { PlanningEvent } from "../utils/types";
import Session from "./Session";
class PlanningApi {
@@ -56,6 +57,8 @@ class PlanningApi {
);
resolve(planningResponseToEvents(response));
} catch (error) {
// En cas d'erreur, on supprime le cache de ViewState
this.session.clearViewStateCache();
reject(error);
}
});

View File

@@ -1,4 +1,5 @@
export { default as Session } from "./api/Session";
export * from "./api/Session";
export * from "./utils/AurionUtils";
export * from "./utils/NotesUtils";
export * from "./utils/PlanningUtils";
export * from "./utils/types";

View File

@@ -1,4 +1,5 @@
import { load } from "cheerio";
import { Note, NotesList } from "./types";
export function getNotesFromResponse(htmlReponse: string): NotesList[] {
// On parcourt le tableau des notes

View File

@@ -1,4 +1,5 @@
import { load } from "cheerio";
import { PlanningEvent } from "./types";
// Conversion du calendrier au format JSON
export function getJSONSchedule(xml: string): object {

View File

@@ -1,4 +1,4 @@
type PlanningEvent = {
export type PlanningEvent = {
id: string;
title: string;
subject: string;
@@ -9,7 +9,7 @@ type PlanningEvent = {
end: string;
className: string;
};
type Note = {
export type Note = {
date: string;
code: string;
subject: string;
@@ -19,7 +19,7 @@ type Note = {
instructor: string;
[key: string]: string;
};
type NotesList = {
export type NotesList = {
code: string;
notes: Note[];
};

View File

@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"module": "ESNext",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,

10
tsup.config.ts Normal file
View 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,
});