@irfanshadikrishad/anilist 1.0.0-forbidden.3 → 1.0.0-forbidden.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,10 +15,10 @@ import { join } from "path";
15
15
  import { Auth } from "./auth.js";
16
16
  import { fetcher } from "./fetcher.js";
17
17
  import { addAnimeToListMutation, addMangaToListMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, } from "./mutations.js";
18
- import { animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, } from "./queries.js";
18
+ import { animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, } from "./queries.js";
19
19
  import { AniListMediaStatus, } from "./types.js";
20
20
  import { Validate } from "./validation.js";
21
- import { anidbToanilistMapper, formatDateObject, getDownloadFolderPath, getNextSeasonAndYear, getTitle, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, selectFile, timestampToTimeAgo, } from "./workers.js";
21
+ import { anidbToanilistMapper, formatDateObject, getDownloadFolderPath, getNextSeasonAndYear, getTitle, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, selectFile, simpleDateFormat, timestampToTimeAgo, } from "./workers.js";
22
22
  class AniList {
23
23
  static importAnime() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -697,6 +697,33 @@ class AniList {
697
697
  }
698
698
  });
699
699
  }
700
+ static getMangaDetailsByID(mangaID) {
701
+ return __awaiter(this, void 0, void 0, function* () {
702
+ var _a;
703
+ try {
704
+ const response = yield fetcher(mangaDetailsQuery, {
705
+ id: mangaID,
706
+ });
707
+ if (response === null || response === void 0 ? void 0 : response.errors) {
708
+ console.error(`${response.errors[0].message}`);
709
+ return;
710
+ }
711
+ const manga = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.Media;
712
+ if (manga) {
713
+ console.log(`\n[${getTitle(manga.title)}]`);
714
+ console.log(`${manga.description}`);
715
+ console.log(`Chapters: ${manga.chapters}\t Volumes: ${manga.volumes}`);
716
+ console.log(`Status:\t${manga.status}`);
717
+ console.log(`Genres:\t${manga.genres.join(", ")}`);
718
+ console.log(`Start:\t${simpleDateFormat(manga.startDate)}`);
719
+ console.log(`End:\t${simpleDateFormat(manga.endDate)}`);
720
+ }
721
+ }
722
+ catch (error) {
723
+ console.error(`${error.message}`);
724
+ }
725
+ });
726
+ }
700
727
  static searchAnime(search, count) {
701
728
  return __awaiter(this, void 0, void 0, function* () {
702
729
  var _a, _b, _c;
@@ -25,4 +25,5 @@ declare const specificUserActivitiesQuery = "\nquery ($page: Int, $perPage: Int,
25
25
  declare const userFollowingQuery = "query ($userId: Int!, $page: Int) {\n Page (page: $page) {\n pageInfo { total perPage currentPage lastPage hasNextPage }\n following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }\n }\n}\n";
26
26
  declare const userFollowersQuery = "query ($userId: Int!, $page: Int) {\n Page (page: $page) {\n pageInfo { total perPage currentPage lastPage hasNextPage }\n followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }\n }\n}\n";
27
27
  declare const toggleFollowMutation = "mutation ($userId: Int!) {\n ToggleFollow(userId: $userId) { id name isFollower isFollowing }\n}\n";
28
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
28
+ declare const mangaDetailsQuery = "query ($id: Int) {\n Media(id: $id, type: MANGA) {\n id title { romaji english native userPreferred } coverImage { color medium large extraLarge } \n bannerImage description chapters volumes status genres\n startDate { year month day } endDate { year month day }\n }\n}\n";
29
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -177,4 +177,12 @@ const toggleFollowMutation = `mutation ($userId: Int!) {
177
177
  ToggleFollow(userId: $userId) { id name isFollower isFollowing }
178
178
  }
179
179
  `;
180
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
180
+ const mangaDetailsQuery = `query ($id: Int) {
181
+ Media(id: $id, type: MANGA) {
182
+ id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
183
+ bannerImage description chapters volumes status genres
184
+ startDate { year month day } endDate { year month day }
185
+ }
186
+ }
187
+ `;
188
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -186,9 +186,9 @@ interface Myself {
186
186
  }[];
187
187
  }
188
188
  interface DateMonthYear {
189
- day?: number;
190
- month?: number;
191
- year?: number;
189
+ day?: number | null;
190
+ month?: number | null;
191
+ year?: number | null;
192
192
  }
193
193
  interface AnimeDetails {
194
194
  data?: {
@@ -432,4 +432,31 @@ type SpecificUserActivitiesResponse = {
432
432
  message: string;
433
433
  }[];
434
434
  };
435
- export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, SpecificUserActivitiesResponse, TheActivity, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
435
+ type Error = {
436
+ message: string;
437
+ }[];
438
+ type CoverImage = {
439
+ color: string;
440
+ medium: string;
441
+ large: string;
442
+ extraLarge: string;
443
+ };
444
+ type MangaDetails = {
445
+ data?: {
446
+ Media: {
447
+ id: number;
448
+ title: MediaTitle;
449
+ coverImage: CoverImage;
450
+ bannerImage: string;
451
+ description: string;
452
+ chapters: number | null;
453
+ volumes: number | null;
454
+ status: string;
455
+ genres: [string];
456
+ startDate: DateMonthYear;
457
+ endDate: DateMonthYear;
458
+ };
459
+ };
460
+ errors?: Error;
461
+ };
462
+ export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MangaDetails, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, SpecificUserActivitiesResponse, TheActivity, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
@@ -1,4 +1,4 @@
1
- import { MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
1
+ import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
2
2
  declare const aniListEndpoint = "https://graphql.anilist.co";
3
3
  declare const redirectUri = "https://anilist.co/api/v2/oauth/pin";
4
4
  declare function getTitle(title: {
@@ -46,4 +46,5 @@ declare function activityBy(activity: TheActivity, count?: number): string;
46
46
  * @returns string of file path
47
47
  */
48
48
  declare function saveToPath(data_type: string, file_format: string): Promise<string>;
49
- export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, timestampToTimeAgo, };
49
+ declare function simpleDateFormat(date: DateMonthYear): string;
50
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
@@ -411,4 +411,10 @@ function saveToPath(data_type, file_format) {
411
411
  return join(getDownloadFolderPath(), `${yield Auth.MyUserName()}@irfanshadikrishad-anilist-${data_type}-${getFormattedDate()}.${file_format}`);
412
412
  });
413
413
  }
414
- export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, timestampToTimeAgo, };
414
+ function simpleDateFormat(date) {
415
+ if (!date.day && !date.month && !date.year) {
416
+ return `null`;
417
+ }
418
+ return `${date === null || date === void 0 ? void 0 : date.day}/${date === null || date === void 0 ? void 0 : date.month}/${date === null || date === void 0 ? void 0 : date.year}`;
419
+ }
420
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
package/bin/index.js CHANGED
@@ -128,6 +128,13 @@ cli
128
128
  console.error(`\nInvalid or missing ID (${id}). Please provide a valid numeric ID.`);
129
129
  }
130
130
  }));
131
+ cli
132
+ .command("manga <id>")
133
+ .description("Get manga details by their ID")
134
+ .option("-c, --count <number>", "Number of items to get", "10")
135
+ .action((id) => __awaiter(void 0, void 0, void 0, function* () {
136
+ yield AniList.getMangaDetailsByID(id);
137
+ }));
131
138
  cli
132
139
  .command("search <query>")
133
140
  .alias("srch")
package/package.json CHANGED
@@ -1,84 +1,84 @@
1
- {
2
- "name": "@irfanshadikrishad/anilist",
3
- "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
- "author": "Irfan Shadik Rishad",
5
- "version": "1.0.0-forbidden.3",
6
- "main": "./bin/index.js",
7
- "type": "module",
8
- "types": "./bin/index.d.ts",
9
- "bin": {
10
- "anilist": "./bin/index.js"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "scripts": {
16
- "build": "rm -rf ./bin && tsc",
17
- "buildw": "rm -rf ./bin && tsc -w",
18
- "format": "prettier . --write",
19
- "format:check": "prettier . --check",
20
- "lint": "eslint ./dist",
21
- "lint:fix": "eslint ./dist --fix",
22
- "all": "npm run build && npm run lint && npm run lint:fix && npm run format && npm test",
23
- "test": "jest ./tests"
24
- },
25
- "keywords": [
26
- "anilist",
27
- "CLI",
28
- "anime",
29
- "manga",
30
- "anime list",
31
- "manga list",
32
- "anime tracker",
33
- "manga tracker",
34
- "anilist API",
35
- "anime progress",
36
- "manga progress",
37
- "media list",
38
- "export anime",
39
- "import anime",
40
- "export manga",
41
- "import manga",
42
- "status tracker",
43
- "watchlist",
44
- "reading list",
45
- "graphql"
46
- ],
47
- "repository": {
48
- "type": "git",
49
- "url": "https://github.com/irfanshadikrishad/anilist"
50
- },
51
- "homepage": "https://github.com/irfanshadikrishad/anilist",
52
- "bugs": {
53
- "url": "https://github.com/irfanshadikrishad/anilist/issues"
54
- },
55
- "license": "MPL-2.0",
56
- "devDependencies": {
57
- "@babel/preset-env": "^7.26.7",
58
- "@eslint/js": "^9.19.0",
59
- "@types/jest": "^29.5.14",
60
- "@types/node": "^22.12.0",
61
- "@types/papaparse": "^5.3.15",
62
- "@types/xml2js": "^0.4.14",
63
- "@typescript-eslint/eslint-plugin": "^8.22.0",
64
- "eslint": "^9.19.0",
65
- "globals": "^15.14.0",
66
- "jest": "^29.7.0",
67
- "prettier": "^3.4.2",
68
- "prettier-plugin-organize-imports": "^4.1.0",
69
- "ts-jest": "^29.2.5",
70
- "ts-node": "^10.9.2",
71
- "typescript": "^5.7.3"
72
- },
73
- "dependencies": {
74
- "commander": "^13.1.0",
75
- "fast-xml-parser": "^4.5.1",
76
- "inquirer": "^12.3.3",
77
- "jsonrepair": "^3.11.2",
78
- "node-fetch": "^3.3.2",
79
- "open": "^10.1.0",
80
- "papaparse": "^5.5.2",
81
- "tiny-spinner": "^2.0.5",
82
- "xml2js": "^0.6.2"
83
- }
84
- }
1
+ {
2
+ "name": "@irfanshadikrishad/anilist",
3
+ "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
+ "author": "Irfan Shadik Rishad",
5
+ "version": "1.0.0-forbidden.4",
6
+ "main": "./bin/index.js",
7
+ "type": "module",
8
+ "types": "./bin/index.d.ts",
9
+ "bin": {
10
+ "anilist": "./bin/index.js"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "build": "rm -rf ./bin && tsc",
17
+ "build:watch": "rm -rf ./bin && tsc -w",
18
+ "format": "prettier . --write",
19
+ "format:check": "prettier . --check",
20
+ "lint": "eslint ./dist",
21
+ "lint:fix": "eslint ./dist --fix",
22
+ "all": "npm run build && npm run lint && npm run lint:fix && npm run format && npm test",
23
+ "test": "jest ./tests"
24
+ },
25
+ "keywords": [
26
+ "anilist",
27
+ "CLI",
28
+ "anime",
29
+ "manga",
30
+ "anime list",
31
+ "manga list",
32
+ "anime tracker",
33
+ "manga tracker",
34
+ "anilist API",
35
+ "anime progress",
36
+ "manga progress",
37
+ "media list",
38
+ "export anime",
39
+ "import anime",
40
+ "export manga",
41
+ "import manga",
42
+ "status tracker",
43
+ "watchlist",
44
+ "reading list",
45
+ "graphql"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/irfanshadikrishad/anilist"
50
+ },
51
+ "homepage": "https://github.com/irfanshadikrishad/anilist",
52
+ "bugs": {
53
+ "url": "https://github.com/irfanshadikrishad/anilist/issues"
54
+ },
55
+ "license": "MPL-2.0",
56
+ "devDependencies": {
57
+ "@babel/preset-env": "^7.26.9",
58
+ "@eslint/js": "^9.21.0",
59
+ "@types/jest": "^29.5.14",
60
+ "@types/node": "^22.13.5",
61
+ "@types/papaparse": "^5.3.15",
62
+ "@types/xml2js": "^0.4.14",
63
+ "@typescript-eslint/eslint-plugin": "^8.24.1",
64
+ "eslint": "^9.21.0",
65
+ "globals": "^16.0.0",
66
+ "jest": "^29.7.0",
67
+ "prettier": "^3.5.2",
68
+ "prettier-plugin-organize-imports": "^4.1.0",
69
+ "ts-jest": "^29.2.5",
70
+ "ts-node": "^10.9.2",
71
+ "typescript": "^5.7.3"
72
+ },
73
+ "dependencies": {
74
+ "commander": "^13.1.0",
75
+ "fast-xml-parser": "^5.0.6",
76
+ "inquirer": "^12.4.2",
77
+ "jsonrepair": "^3.12.0",
78
+ "node-fetch": "^3.3.2",
79
+ "open": "^10.1.0",
80
+ "papaparse": "^5.5.2",
81
+ "tiny-spinner": "^2.0.5",
82
+ "xml2js": "^0.6.2"
83
+ }
84
+ }