Remove ".js" from module imports
parent
8a65cf67ff
commit
40f65d9fbb
|
@ -27,7 +27,7 @@ import {
|
||||||
Game,
|
Game,
|
||||||
searchHandiwork,
|
searchHandiwork,
|
||||||
HandiworkSearchQuery
|
HandiworkSearchQuery
|
||||||
} from "./index.js";
|
} from "./index";
|
||||||
|
|
||||||
// Configure the .env reader
|
// Configure the .env reader
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
57
src/index.ts
57
src/index.ts
|
@ -6,27 +6,22 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared from "./scripts/shared.js";
|
import shared from "./scripts/shared";
|
||||||
import search from "./scripts/search.js";
|
import search from "./scripts/search";
|
||||||
import {
|
import { authenticate, urlExists, isF95URL, send2faCode } from "./scripts/network-helper";
|
||||||
authenticate,
|
import fetchLatestHandiworkURLs from "./scripts/fetch-data/fetch-latest";
|
||||||
urlExists,
|
import fetchPlatformData from "./scripts/fetch-data/fetch-platform-data";
|
||||||
isF95URL,
|
import getHandiworkInformation from "./scripts/scrape-data/handiwork-parse";
|
||||||
send2faCode
|
import { IBasic } from "./scripts/interfaces";
|
||||||
} from "./scripts/network-helper.js";
|
|
||||||
import fetchLatestHandiworkURLs from "./scripts/fetch-data/fetch-latest.js";
|
|
||||||
import fetchPlatformData from "./scripts/fetch-data/fetch-platform-data.js";
|
|
||||||
import getHandiworkInformation from "./scripts/scrape-data/handiwork-parse.js";
|
|
||||||
import { IBasic } from "./scripts/interfaces.js";
|
|
||||||
|
|
||||||
// Classes from file
|
// Classes from file
|
||||||
import Credentials from "./scripts/classes/credentials.js";
|
import Credentials from "./scripts/classes/credentials";
|
||||||
import LoginResult from "./scripts/classes/login-result.js";
|
import LoginResult from "./scripts/classes/login-result";
|
||||||
import UserProfile from "./scripts/classes/mapping/user-profile.js";
|
import UserProfile from "./scripts/classes/mapping/user-profile";
|
||||||
import LatestSearchQuery from "./scripts/classes/query/latest-search-query.js";
|
import LatestSearchQuery from "./scripts/classes/query/latest-search-query";
|
||||||
import HandiworkSearchQuery from "./scripts/classes/query/handiwork-search-query.js";
|
import HandiworkSearchQuery from "./scripts/classes/query/handiwork-search-query";
|
||||||
import HandiWork from "./scripts/classes/handiwork/handiwork.js";
|
import HandiWork from "./scripts/classes/handiwork/handiwork";
|
||||||
import { UserNotLogged } from "./scripts/classes/errors.js";
|
import { UserNotLogged } from "./scripts/classes/errors";
|
||||||
|
|
||||||
//#region Global variables
|
//#region Global variables
|
||||||
|
|
||||||
|
@ -36,20 +31,20 @@ const USER_NOT_LOGGED = "User not authenticated, unable to continue";
|
||||||
|
|
||||||
//#region Re-export classes
|
//#region Re-export classes
|
||||||
|
|
||||||
export { default as Animation } from "./scripts/classes/handiwork/animation.js";
|
export { default as Animation } from "./scripts/classes/handiwork/animation";
|
||||||
export { default as Asset } from "./scripts/classes/handiwork/asset.js";
|
export { default as Asset } from "./scripts/classes/handiwork/asset";
|
||||||
export { default as Comic } from "./scripts/classes/handiwork/comic.js";
|
export { default as Comic } from "./scripts/classes/handiwork/comic";
|
||||||
export { default as Game } from "./scripts/classes/handiwork/game.js";
|
export { default as Game } from "./scripts/classes/handiwork/game";
|
||||||
export { default as Handiwork } from "./scripts/classes/handiwork/handiwork.js";
|
export { default as Handiwork } from "./scripts/classes/handiwork/handiwork";
|
||||||
|
|
||||||
export { default as PlatformUser } from "./scripts/classes/mapping/platform-user.js";
|
export { default as PlatformUser } from "./scripts/classes/mapping/platform-user";
|
||||||
export { default as Post } from "./scripts/classes/mapping/post.js";
|
export { default as Post } from "./scripts/classes/mapping/post";
|
||||||
export { default as Thread } from "./scripts/classes/mapping/thread.js";
|
export { default as Thread } from "./scripts/classes/mapping/thread";
|
||||||
export { default as UserProfile } from "./scripts/classes/mapping/user-profile.js";
|
export { default as UserProfile } from "./scripts/classes/mapping/user-profile";
|
||||||
|
|
||||||
export { default as HandiworkSearchQuery } from "./scripts/classes/query/handiwork-search-query.js";
|
export { default as HandiworkSearchQuery } from "./scripts/classes/query/handiwork-search-query";
|
||||||
export { default as LatestSearchQuery } from "./scripts/classes/query/latest-search-query.js";
|
export { default as LatestSearchQuery } from "./scripts/classes/query/latest-search-query";
|
||||||
export { default as ThreadSearchQuery } from "./scripts/classes/query/thread-search-query.js";
|
export { default as ThreadSearchQuery } from "./scripts/classes/query/thread-search-query";
|
||||||
|
|
||||||
//#endregion Re-export classes
|
//#endregion Re-export classes
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import { getF95Token } from "../network-helper.js";
|
import { getF95Token } from "../network-helper";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the credentials used to access the platform.
|
* Represents the credentials used to access the platform.
|
||||||
|
|
|
@ -10,9 +10,9 @@ import cheerio from "cheerio";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
// Modules from files
|
// Modules from files
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import { fetchHTML } from "../../network-helper.js";
|
import { fetchHTML } from "../../network-helper";
|
||||||
import { GENERIC, MEMBER } from "../../constants/css-selector.js";
|
import { GENERIC, MEMBER } from "../../constants/css-selector";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a generic user registered on the platform.
|
* Represents a generic user registered on the platform.
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
import cheerio from "cheerio";
|
import cheerio from "cheerio";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import PlatformUser from "./platform-user.js";
|
import PlatformUser from "./platform-user";
|
||||||
import { IPostElement, parseF95ThreadPost } from "../../scrape-data/post-parse.js";
|
import { IPostElement, parseF95ThreadPost } from "../../scrape-data/post-parse";
|
||||||
import { POST, THREAD } from "../../constants/css-selector.js";
|
import { POST, THREAD } from "../../constants/css-selector";
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import { fetchHTML } from "../../network-helper.js";
|
import { fetchHTML } from "../../network-helper";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a post published by a user on the F95Zone platform.
|
* Represents a post published by a user on the F95Zone platform.
|
||||||
|
|
|
@ -10,20 +10,20 @@ import cheerio from "cheerio";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
// Modules from files
|
// Modules from files
|
||||||
import Post from "./post.js";
|
import Post from "./post";
|
||||||
import PlatformUser from "./platform-user.js";
|
import PlatformUser from "./platform-user";
|
||||||
import { TCategory, TRating } from "../../interfaces.js";
|
import { TCategory, TRating } from "../../interfaces";
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import { POST, THREAD } from "../../constants/css-selector.js";
|
import { POST, THREAD } from "../../constants/css-selector";
|
||||||
import { fetchHTML, fetchPOSTResponse } from "../../network-helper.js";
|
import { fetchHTML, fetchPOSTResponse } from "../../network-helper";
|
||||||
import Shared from "../../shared.js";
|
import Shared from "../../shared";
|
||||||
import {
|
import {
|
||||||
GenericAxiosError,
|
GenericAxiosError,
|
||||||
ParameterError,
|
ParameterError,
|
||||||
UnexpectedResponseContentType
|
UnexpectedResponseContentType
|
||||||
} from "../errors.js";
|
} from "../errors";
|
||||||
import { Result } from "../result.js";
|
import { Result } from "../result";
|
||||||
import { getJSONLD, TJsonLD } from "../../scrape-data/json-ld.js";
|
import { getJSONLD, TJsonLD } from "../../scrape-data/json-ld";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a generic F95Zone platform thread.
|
* Represents a generic F95Zone platform thread.
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
import cheerio from "cheerio";
|
import cheerio from "cheerio";
|
||||||
|
|
||||||
// Modules from files
|
// Modules from files
|
||||||
import Post from "./post.js";
|
import Post from "./post";
|
||||||
import PlatformUser from "./platform-user.js";
|
import PlatformUser from "./platform-user";
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import { GENERIC, WATCHED_THREAD } from "../../constants/css-selector.js";
|
import { GENERIC, WATCHED_THREAD } from "../../constants/css-selector";
|
||||||
import { fetchHTML } from "../../network-helper.js";
|
import { fetchHTML } from "../../network-helper";
|
||||||
import { GenericAxiosError, UnexpectedResponseContentType } from "../errors.js";
|
import { GenericAxiosError, UnexpectedResponseContentType } from "../errors";
|
||||||
import { Result } from "../result.js";
|
import { Result } from "../result";
|
||||||
|
|
||||||
// Interfaces
|
// Interfaces
|
||||||
interface IWatchedThread {
|
interface IWatchedThread {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared, { TPrefixDict } from "../shared.js";
|
import shared, { TPrefixDict } from "../shared";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert prefixes and platform tags from string to ID and vice versa.
|
* Convert prefixes and platform tags from string to ID and vice versa.
|
||||||
|
|
|
@ -10,11 +10,11 @@ import { IsInt, Min, validateSync } from "class-validator";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
|
|
||||||
// Module from files
|
// Module from files
|
||||||
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
|
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
|
||||||
import { GenericAxiosError } from "../errors.js";
|
import { GenericAxiosError } from "../errors";
|
||||||
import { Result } from "../result.js";
|
import { Result } from "../result";
|
||||||
import LatestSearchQuery, { TLatestOrder } from "./latest-search-query.js";
|
import LatestSearchQuery, { TLatestOrder } from "./latest-search-query";
|
||||||
import ThreadSearchQuery, { TThreadOrder } from "./thread-search-query.js";
|
import ThreadSearchQuery, { TThreadOrder } from "./thread-search-query";
|
||||||
|
|
||||||
// Type definitions
|
// Type definitions
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
import { ArrayMaxSize, IsInt, Min, validateSync } from "class-validator";
|
import { ArrayMaxSize, IsInt, Min, validateSync } from "class-validator";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import PrefixParser from "../prefix-parser.js";
|
import PrefixParser from "../prefix-parser";
|
||||||
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
|
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
|
||||||
import { fetchGETResponse } from "../../network-helper.js";
|
import { fetchGETResponse } from "../../network-helper";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { GenericAxiosError } from "../errors.js";
|
import { GenericAxiosError } from "../errors";
|
||||||
import { Result } from "../result.js";
|
import { Result } from "../result";
|
||||||
|
|
||||||
// Type definitions
|
// Type definitions
|
||||||
export type TLatestOrder = "date" | "likes" | "views" | "title" | "rating";
|
export type TLatestOrder = "date" | "likes" | "views" | "title" | "rating";
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
import { IsInt, Min, validateSync } from "class-validator";
|
import { IsInt, Min, validateSync } from "class-validator";
|
||||||
|
|
||||||
// Module from files
|
// Module from files
|
||||||
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
|
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
|
||||||
import { urls } from "../../constants/url.js";
|
import { urls } from "../../constants/url";
|
||||||
import PrefixParser from "./../prefix-parser.js";
|
import PrefixParser from "./../prefix-parser";
|
||||||
import { fetchPOSTResponse } from "../../network-helper.js";
|
import { fetchPOSTResponse } from "../../network-helper";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { GenericAxiosError } from "../errors.js";
|
import { GenericAxiosError } from "../errors";
|
||||||
import { Result } from "../result.js";
|
import { Result } from "../result";
|
||||||
import Shared from "../../shared.js";
|
import Shared from "../../shared";
|
||||||
|
|
||||||
// Type definitions
|
// Type definitions
|
||||||
export type TThreadOrder = "relevance" | "date" | "last_update" | "replies";
|
export type TThreadOrder = "relevance" | "date" | "last_update" | "replies";
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
|
import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
|
||||||
import LatestSearchQuery from "../classes/query/latest-search-query";
|
import LatestSearchQuery from "../classes/query/latest-search-query";
|
||||||
import ThreadSearchQuery from "../classes/query/thread-search-query";
|
import ThreadSearchQuery from "../classes/query/thread-search-query";
|
||||||
import fetchLatestHandiworkURLs from "./fetch-latest.js";
|
import fetchLatestHandiworkURLs from "./fetch-latest";
|
||||||
import fetchThreadHandiworkURLs from "./fetch-thread.js";
|
import fetchThreadHandiworkURLs from "./fetch-thread";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URLs of the handiworks that match the passed parameters.
|
* Gets the URLs of the handiworks that match the passed parameters.
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import LatestSearchQuery from "../classes/query/latest-search-query.js";
|
import LatestSearchQuery from "../classes/query/latest-search-query";
|
||||||
import { urls } from "../constants/url.js";
|
import { urls } from "../constants/url";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URLs of the latest handiworks that match the passed parameters.
|
* Gets the URLs of the latest handiworks that match the passed parameters.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import { readFileSync, writeFileSync, existsSync } from "fs";
|
||||||
import cheerio from "cheerio";
|
import cheerio from "cheerio";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared, { TPrefixDict } from "../shared.js";
|
import shared, { TPrefixDict } from "../shared";
|
||||||
import { urls as f95url } from "../constants/url.js";
|
import { urls as f95url } from "../constants/url";
|
||||||
import { GENERIC } from "../constants/css-selector.js";
|
import { GENERIC } from "../constants/css-selector";
|
||||||
import { fetchHTML } from "../network-helper.js";
|
import { fetchHTML } from "../network-helper";
|
||||||
|
|
||||||
//#region Interface definitions
|
//#region Interface definitions
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from files
|
// Modules from files
|
||||||
import fetchHandiworkURLs from "./fetch-handiwork.js";
|
import fetchHandiworkURLs from "./fetch-handiwork";
|
||||||
import fetchLatestHandiworkURLs from "./fetch-latest.js";
|
import fetchLatestHandiworkURLs from "./fetch-latest";
|
||||||
import fetchThreadHandiworkURLs from "./fetch-thread.js";
|
import fetchThreadHandiworkURLs from "./fetch-thread";
|
||||||
import HandiworkSearchQuery from "../classes/query/handiwork-search-query.js";
|
import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
|
||||||
import LatestSearchQuery from "../classes/query/latest-search-query.js";
|
import LatestSearchQuery from "../classes/query/latest-search-query";
|
||||||
import ThreadSearchQuery from "../classes/query/thread-search-query.js";
|
import ThreadSearchQuery from "../classes/query/thread-search-query";
|
||||||
import { IQuery } from "../interfaces.js";
|
import { IQuery } from "../interfaces";
|
||||||
|
|
||||||
//#region Public methods
|
//#region Public methods
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
import cheerio from "cheerio";
|
import cheerio from "cheerio";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared from "../shared.js";
|
import shared from "../shared";
|
||||||
import { THREAD_SEARCH } from "../constants/css-selector.js";
|
import { THREAD_SEARCH } from "../constants/css-selector";
|
||||||
import { urls as f95urls } from "../constants/url.js";
|
import { urls as f95urls } from "../constants/url";
|
||||||
import ThreadSearchQuery from "../classes/query/thread-search-query.js";
|
import ThreadSearchQuery from "../classes/query/thread-search-query";
|
||||||
|
|
||||||
//#region Public methods
|
//#region Public methods
|
||||||
|
|
||||||
|
|
|
@ -11,17 +11,17 @@ import cheerio from "cheerio";
|
||||||
import axiosCookieJarSupport from "axios-cookiejar-support";
|
import axiosCookieJarSupport from "axios-cookiejar-support";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared from "./shared.js";
|
import shared from "./shared";
|
||||||
import { urls } from "./constants/url.js";
|
import { urls } from "./constants/url";
|
||||||
import { GENERIC } from "./constants/css-selector.js";
|
import { GENERIC } from "./constants/css-selector";
|
||||||
import LoginResult from "./classes/login-result.js";
|
import LoginResult from "./classes/login-result";
|
||||||
import { failure, Result, success } from "./classes/result.js";
|
import { failure, Result, success } from "./classes/result";
|
||||||
import {
|
import {
|
||||||
GenericAxiosError,
|
GenericAxiosError,
|
||||||
InvalidF95Token,
|
InvalidF95Token,
|
||||||
UnexpectedResponseContentType
|
UnexpectedResponseContentType
|
||||||
} from "./classes/errors.js";
|
} from "./classes/errors";
|
||||||
import Credentials from "./classes/credentials.js";
|
import Credentials from "./classes/credentials";
|
||||||
|
|
||||||
// Configure axios to use the cookie jar
|
// Configure axios to use the cookie jar
|
||||||
axiosCookieJarSupport(axios);
|
axiosCookieJarSupport(axios);
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
// Modules from files
|
// Modules from files
|
||||||
import HandiWork from "../classes/handiwork/handiwork.js";
|
import HandiWork from "../classes/handiwork/handiwork";
|
||||||
import Thread from "../classes/mapping/thread.js";
|
import Thread from "../classes/mapping/thread";
|
||||||
import { IBasic, TAuthor, TEngine, TExternalPlatform, TStatus } from "../interfaces.js";
|
import { IBasic, TAuthor, TEngine, TExternalPlatform, TStatus } from "../interfaces";
|
||||||
import shared, { TPrefixDict } from "../shared.js";
|
import shared, { TPrefixDict } from "../shared";
|
||||||
import { ILink, IPostElement } from "./post-parse.js";
|
import { ILink, IPostElement } from "./post-parse";
|
||||||
|
|
||||||
export async function getHandiworkInformation<T extends IBasic>(url: string): Promise<T>;
|
export async function getHandiworkInformation<T extends IBasic>(url: string): Promise<T>;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
import cheerio from "cheerio";
|
import cheerio from "cheerio";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import shared from "../shared.js";
|
import shared from "../shared";
|
||||||
import { THREAD } from "../constants/css-selector.js";
|
import { THREAD } from "../constants/css-selector";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents information contained in a JSON+LD tag.
|
* Represents information contained in a JSON+LD tag.
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import { IBasic, IQuery } from "./interfaces.js";
|
import { IBasic, IQuery } from "./interfaces";
|
||||||
import getHandiworkInformation from "./scrape-data/handiwork-parse.js";
|
import getHandiworkInformation from "./scrape-data/handiwork-parse";
|
||||||
import getURLsFromQuery from "./fetch-data/fetch-query.js";
|
import getURLsFromQuery from "./fetch-data/fetch-query";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the handiworks that match the passed parameters.
|
* Gets the handiworks that match the passed parameters.
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { join } from "path";
|
||||||
import log4js from "log4js";
|
import log4js from "log4js";
|
||||||
|
|
||||||
// Modules from file
|
// Modules from file
|
||||||
import Session from "./classes/session.js";
|
import Session from "./classes/session";
|
||||||
|
|
||||||
// Types declaration
|
// Types declaration
|
||||||
export type TPrefixDict = { [n: number]: string };
|
export type TPrefixDict = { [n: number]: string };
|
||||||
|
|
Loading…
Reference in New Issue