Skip to content

Commit

Permalink
удалил лишние пути в paths
Browse files Browse the repository at this point in the history
  • Loading branch information
lentryd committed Aug 28, 2023
1 parent 8bf18f4 commit 921fa53
Show file tree
Hide file tree
Showing 31 changed files with 85 additions and 94 deletions.
72 changes: 36 additions & 36 deletions src/NetSchoolApi-safe.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import Client, { InitRequest } from "@classes/Client";
import Session from "@classes/Session";
import Context from "@classes/Context";

import logIn from "@methods/logIn";
import logOut from "@methods/logOut";
import context from "@methods/context";
import sessionValid from "@methods/sessionValid";

import info from "@methods/info";
import photo from "@methods/photo";

import diary from "@methods/diary";
import assignment from "@methods/assignment";
import downloadFile from "@methods/downloadFile";
import assignmentTypes from "@methods/assignmentTypes";

import scheduleDay from "@methods/scheduleDay";
import scheduleWeek from "@methods/scheduleWeek";

import reportFile from "@methods/reportFile";
import grades from "@methods/grades";
import journal from "@methods/journal";

import fetch from "@methods/fetch";

import { Credentials as PhotoCredentials } from "@methods/photo";
import { Credentials as DiaryCredentials } from "@methods/diary";
import { Credentials as AssignmentCredentials } from "@methods/assignment";
import { Credentials as DownloadFileCredentials } from "@methods/downloadFile";
import { Credentials as ScheduleDayCredentials } from "@methods/scheduleDay";
import { Credentials as ScheduleWeekCredentials } from "@methods/scheduleWeek";
import { Credentials as ReportFileCredentials } from "@methods/reportFile";
import { Credentials as GradesCredentials } from "@methods/grades";
import { Credentials as JournalCredentials } from "@methods/journal";
import Client, { InitRequest } from "@/classes/Client";
import Session from "@/classes/Session";
import Context from "@/classes/Context";

import logIn from "@/methods/logIn";
import logOut from "@/methods/logOut";
import context from "@/methods/context";
import sessionValid from "@/methods/sessionValid";

import info from "@/methods/info";
import photo from "@/methods/photo";

import diary from "@/methods/diary";
import assignment from "@/methods/assignment";
import downloadFile from "@/methods/downloadFile";
import assignmentTypes from "@/methods/assignmentTypes";

import scheduleDay from "@/methods/scheduleDay";
import scheduleWeek from "@/methods/scheduleWeek";

import reportFile from "@/methods/reportFile";
import grades from "@/methods/grades";
import journal from "@/methods/journal";

import fetch from "@/methods/fetch";

import { Credentials as PhotoCredentials } from "@/methods/photo";
import { Credentials as DiaryCredentials } from "@/methods/diary";
import { Credentials as AssignmentCredentials } from "@/methods/assignment";
import { Credentials as DownloadFileCredentials } from "@/methods/downloadFile";
import { Credentials as ScheduleDayCredentials } from "@/methods/scheduleDay";
import { Credentials as ScheduleWeekCredentials } from "@/methods/scheduleWeek";
import { Credentials as ReportFileCredentials } from "@/methods/reportFile";
import { Credentials as GradesCredentials } from "@/methods/grades";
import { Credentials as JournalCredentials } from "@/methods/journal";

export type PasswordType = string | { hash: string; length: number };

Expand All @@ -52,7 +52,7 @@ export default class NetSchoolApiSafe {

/**
* Создание пользователя
* @param credentials Данные пользователя
* @/param credentials Данные пользователя
*/
constructor(credentials: Credentials) {
this.credentials = credentials;
Expand Down
2 changes: 1 addition & 1 deletion src/NetSchoolApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NS, { Credentials } from "@NS";
import Session from "@classes/Session";
import Session from "@/classes/Session";

let activeClasses = 0;
const errors: string[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Assignment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Attachment, {
AttachmentObject,
AnswerFilesObject,
} from "@classes/Attachment";
} from "@/classes/Attachment";

type Mark = {
assignmentId: number;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Client/methods/cookie/decode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Преобразование строки в объект
* @param cookie Значение заголовка `set-cookie`
* @/param cookie Значение заголовка `set-cookie`
*/
export default function (cookie?: string[]) {
return cookie
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Client/methods/cookie/encode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Преобразование объекта в строку
* @param cookie Объект с куки файлами
* @/param cookie Объект с куки файлами
*/
export default function (cookie: { [key: string]: string }) {
const cookies = [];
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Client/methods/url/isAbsolute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const absoluteRegex = new RegExp("^(?:[a-z]+:)?//", "i");

/**
* Является ли ссылка абсолютной
* @param path Путь к ресурсу
* @/param path Путь к ресурсу
*/
export default function (path: string) {
return absoluteRegex.test(path);
Expand Down
4 changes: 2 additions & 2 deletions src/classes/Client/methods/url/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { posix } from "path";

/**
*
* @param origin Ссылка на сайт, например http://example.com
* @param paths Путь до требуемого ресурса
* @/param origin Ссылка на сайт, например http://example.com
* @/param paths Путь до требуемого ресурса
*/
export default function (origin: string, ...paths: string[]) {
return new URL(posix.join(...paths), origin).href;
Expand Down
6 changes: 3 additions & 3 deletions src/classes/Journal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { str2date, date2JSON } from "@utils/dateNum";
import { query, table } from "@utils/parseHtml";
import { str2date, date2JSON } from "@/utils/dateNum";
import { query, table } from "@/utils/parseHtml";
import { HTMLElement } from "node-html-parser";
import Context from "@classes/Context";
import Context from "@/classes/Context";

interface Credentials {
htmlText: string;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/assignment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import { sessionValid, studentIdValid } from "@utils/checks";
import AssignmentInfo from "@classes/AssignmentInfo";
import { sessionValid, studentIdValid } from "@/utils/checks";
import AssignmentInfo from "@/classes/AssignmentInfo";

export interface Credentials {
studentId?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/assignmentTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import { sessionValid } from "@utils/checks";
import AssignmentTypes from "@classes/AssignmentTypes";
import { sessionValid } from "@/utils/checks";
import AssignmentTypes from "@/classes/AssignmentTypes";

export default async function (this: NS) {
await sessionValid.call(this);
Expand Down
2 changes: 1 addition & 1 deletion src/methods/context/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NS from "@NS";
import Context from "@classes/Context";
import Context from "@/classes/Context";

import sysInfo from "./methods/sysInfo";
import context from "./methods/context";
Expand Down
2 changes: 1 addition & 1 deletion src/methods/context/methods/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

interface GlobalYear {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/context/methods/schoolInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

interface LocationType {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/context/methods/studentGrades.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

interface RelatedObject {
type: string;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/context/methods/sysInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

export default async function (client: Client) {
const text = await client.get("sysInfo").then((res) => res.text());
Expand Down
4 changes: 2 additions & 2 deletions src/methods/diary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import Diary, { DiaryObject } from "@classes/Diary";
import { sessionValid, dateValid, studentIdValid } from "@utils/checks";
import Diary, { DiaryObject } from "@/classes/Diary";
import { sessionValid, dateValid, studentIdValid } from "@/utils/checks";
import { AttachmentObject, AnswerFilesObject } from "@/classes/Attachment";

type AttachmentRaw = {
Expand Down
2 changes: 1 addition & 1 deletion src/methods/downloadFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NS from "@NS";
import { sessionValid, studentIdValid } from "@utils/checks";
import { sessionValid, studentIdValid } from "@/utils/checks";

export interface Credentials {
studentId?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import { InitRequest } from "@classes/Client";
import { sessionValid } from "@utils/checks";
import { InitRequest } from "@/classes/Client";
import { sessionValid } from "@/utils/checks";

export default async function (this: NS, url: string, init?: InitRequest) {
const { client } = await sessionValid.call(this);
Expand Down
6 changes: 3 additions & 3 deletions src/methods/grades.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import NS from "@NS";
import Grades from "@classes/Grades";
import { date2JSON } from "@utils/dateNum";
import Grades from "@/classes/Grades";
import { date2JSON } from "@/utils/dateNum";
import {
sessionValid,
dateValid,
classIdValid,
studentIdValid,
} from "@utils/checks";
} from "@/utils/checks";

export interface Credentials {
subjectId: number;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/info.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import Info from "@classes/Info";
import { sessionValid } from "@utils/checks";
import Info from "@/classes/Info";
import { sessionValid } from "@/utils/checks";

export default async function (this: NS) {
const { client } = await sessionValid.call(this);
Expand Down
6 changes: 3 additions & 3 deletions src/methods/journal.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import NS from "@NS";
import Journal from "@classes/Journal";
import { date2JSON } from "@utils/dateNum";
import Journal from "@/classes/Journal";
import { date2JSON } from "@/utils/dateNum";
import {
classIdValid,
dateValid,
sessionValid,
studentIdValid,
} from "@utils/checks";
} from "@/utils/checks";

export interface Credentials {
start?: Date;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/logIn/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NS from "@NS";
import Session from "@classes/Session";
import Session from "@/classes/Session";

import signIn from "./methods/signIn";

Expand Down
2 changes: 1 addition & 1 deletion src/methods/logIn/methods/authData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

export interface AuthData {
lt: string;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/logIn/methods/schoolInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Client from "@classes/Client";
import Client from "@/classes/Client";

interface SchoolSearchData {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/logIn/methods/signIn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Credentials } from "@NS";
import Client from "@classes/Client";
import Client from "@/classes/Client";

import authData from "./authData";
import schoolInfo from "./schoolInfo";
Expand Down
4 changes: 2 additions & 2 deletions src/methods/logOut/signOut.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Session from "@classes/Session";
import Client from "@classes/Client";
import Session from "@/classes/Session";
import Client from "@/classes/Client";

export default function (client: Client, session: Session) {
const { accessToken: at, ver } = session;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/photo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NS from "@NS";
import Client from "@classes/Client";
import { sessionValid, studentIdValid } from "@utils/checks";
import Client from "@/classes/Client";
import { sessionValid, studentIdValid } from "@/utils/checks";

export interface Credentials {
studentId?: number;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/reportFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NS from "@NS";
import { sessionValid } from "@utils/checks";
import { sessionValid } from "@/utils/checks";

type Filter = {
filterId: string;
Expand Down
8 changes: 4 additions & 4 deletions src/methods/scheduleDay.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import NS from "@NS";
import Client from "@classes/Client";
import ScheduleDay from "@classes/ScheduleDay";
import { date2str } from "@utils/dateNum";
import { sessionValid, dateValid, classIdValid } from "@utils/checks";
import Client from "@/classes/Client";
import ScheduleDay from "@/classes/ScheduleDay";
import { date2str } from "@/utils/dateNum";
import { sessionValid, dateValid, classIdValid } from "@/utils/checks";

export interface Credentials {
date?: Date;
Expand Down
8 changes: 4 additions & 4 deletions src/methods/scheduleWeek.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import NS from "@NS";
import Client from "@classes/Client";
import ScheduleWeek from "@classes/ScheduleWeek";
import { date2str } from "@utils/dateNum";
import { sessionValid, dateValid, classIdValid } from "@utils/checks";
import Client from "@/classes/Client";
import ScheduleWeek from "@/classes/ScheduleWeek";
import { date2str } from "@/utils/dateNum";
import { sessionValid, dateValid, classIdValid } from "@/utils/checks";

export interface Credentials {
date?: Date;
Expand Down
9 changes: 0 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@
],
"@NS": [
"src/NetSchoolApi-safe.ts"
],
"@utils/*": [
"src/utils/*"
],
"@classes/*": [
"src/classes/*"
],
"@methods/*": [
"src/methods/*"
]
}
},
Expand Down

0 comments on commit 921fa53

Please sign in to comment.