@irfanshadikrishad/anilist 1.1.10 → 1.2.1-forbidden.1
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.
- package/README.md +16 -3
- package/assets/binance.jpg +0 -0
- package/bin/helpers/auth.d.ts +39 -6
- package/bin/helpers/auth.js +260 -94
- package/bin/helpers/fetcher.d.ts +2 -1
- package/bin/helpers/fetcher.js +9 -3
- package/bin/helpers/lists.js +74 -136
- package/bin/helpers/mutations.d.ts +2 -1
- package/bin/helpers/mutations.js +6 -1
- package/bin/helpers/queries.d.ts +7 -4
- package/bin/helpers/queries.js +36 -7
- package/bin/helpers/types.d.ts +112 -8
- package/bin/helpers/workers.d.ts +3 -1
- package/bin/helpers/workers.js +37 -2
- package/bin/index.js +11 -7
- package/package.json +80 -75
- /package/{LICENSE → LICENSE.md} +0 -0
package/bin/helpers/types.d.ts
CHANGED
|
@@ -84,13 +84,7 @@ declare enum MALMangaStatus {
|
|
|
84
84
|
interface AnimeList {
|
|
85
85
|
data?: {
|
|
86
86
|
MediaListCollection: {
|
|
87
|
-
lists:
|
|
88
|
-
name: string;
|
|
89
|
-
entries: {
|
|
90
|
-
id: number;
|
|
91
|
-
progress: number;
|
|
92
|
-
}[];
|
|
93
|
-
}[];
|
|
87
|
+
lists: MediaList[];
|
|
94
88
|
};
|
|
95
89
|
};
|
|
96
90
|
errors?: {
|
|
@@ -108,4 +102,114 @@ interface MediaWithProgress {
|
|
|
108
102
|
romaji?: string;
|
|
109
103
|
};
|
|
110
104
|
}
|
|
111
|
-
|
|
105
|
+
interface MediaTitle {
|
|
106
|
+
english?: string;
|
|
107
|
+
romaji?: string;
|
|
108
|
+
native?: string;
|
|
109
|
+
userPreferred?: string;
|
|
110
|
+
}
|
|
111
|
+
interface Media {
|
|
112
|
+
id: number;
|
|
113
|
+
idMal?: number;
|
|
114
|
+
title: MediaTitle;
|
|
115
|
+
chapters?: number;
|
|
116
|
+
}
|
|
117
|
+
interface MediaEntry {
|
|
118
|
+
media: Media;
|
|
119
|
+
private: boolean;
|
|
120
|
+
progress: number;
|
|
121
|
+
status: string;
|
|
122
|
+
hiddenFromStatusLists: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface List {
|
|
125
|
+
name: string;
|
|
126
|
+
entries: MediaEntry[];
|
|
127
|
+
}
|
|
128
|
+
interface MediaList {
|
|
129
|
+
id(id: number | string): string;
|
|
130
|
+
title: {
|
|
131
|
+
english?: string;
|
|
132
|
+
romaji?: string;
|
|
133
|
+
};
|
|
134
|
+
name: string;
|
|
135
|
+
entries: MediaListEntry[];
|
|
136
|
+
}
|
|
137
|
+
interface Myself {
|
|
138
|
+
data?: {
|
|
139
|
+
Viewer: {
|
|
140
|
+
id: number;
|
|
141
|
+
name: string;
|
|
142
|
+
siteUrl: string;
|
|
143
|
+
options: {
|
|
144
|
+
profileColor: string;
|
|
145
|
+
timezone: string;
|
|
146
|
+
activityMergeTime: string;
|
|
147
|
+
};
|
|
148
|
+
donatorTier: string;
|
|
149
|
+
donatorBadge: string;
|
|
150
|
+
unreadNotificationCount: number;
|
|
151
|
+
createdAt: number;
|
|
152
|
+
updatedAt: number;
|
|
153
|
+
statistics: {
|
|
154
|
+
anime: {
|
|
155
|
+
count: number;
|
|
156
|
+
meanScore: string;
|
|
157
|
+
minutesWatched: string;
|
|
158
|
+
episodesWatched: number;
|
|
159
|
+
};
|
|
160
|
+
manga: {
|
|
161
|
+
count: number;
|
|
162
|
+
meanScore: string;
|
|
163
|
+
chaptersRead: number;
|
|
164
|
+
volumesRead: number;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
errors?: {
|
|
170
|
+
message: string;
|
|
171
|
+
}[];
|
|
172
|
+
}
|
|
173
|
+
interface DateMonthYear {
|
|
174
|
+
day?: string;
|
|
175
|
+
month?: string;
|
|
176
|
+
year?: string;
|
|
177
|
+
}
|
|
178
|
+
interface AnimeDetails {
|
|
179
|
+
data?: {
|
|
180
|
+
Media: {
|
|
181
|
+
id: number;
|
|
182
|
+
title: MediaTitle;
|
|
183
|
+
description: string;
|
|
184
|
+
duration: string;
|
|
185
|
+
startDate: DateMonthYear;
|
|
186
|
+
endDate: DateMonthYear;
|
|
187
|
+
countryOfOrigin: string;
|
|
188
|
+
isAdult: boolean;
|
|
189
|
+
status: string;
|
|
190
|
+
season: string;
|
|
191
|
+
format: string;
|
|
192
|
+
genres: [string];
|
|
193
|
+
siteUrl: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
errors?: {
|
|
197
|
+
message: string;
|
|
198
|
+
}[];
|
|
199
|
+
}
|
|
200
|
+
interface MediaListEntry {
|
|
201
|
+
id?: number;
|
|
202
|
+
media: {
|
|
203
|
+
id?: number;
|
|
204
|
+
idMal?: number;
|
|
205
|
+
title?: MediaTitle;
|
|
206
|
+
episodes?: number;
|
|
207
|
+
siteUrl?: string;
|
|
208
|
+
chapters?: number;
|
|
209
|
+
};
|
|
210
|
+
progress?: number;
|
|
211
|
+
status?: string;
|
|
212
|
+
hiddenFromStatusLists?: boolean;
|
|
213
|
+
private?: boolean;
|
|
214
|
+
}
|
|
215
|
+
export { AniListMediaStatus, AnimeDetails, AnimeList, DateMonthYear, DeleteMangaResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListEntry, MediaTitle, MediaWithProgress, Myself, saveAnimeWithProgressResponse, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -34,4 +34,6 @@ declare function createAnimeXML(malId: number, progress: number, status: MALAnim
|
|
|
34
34
|
declare function createMangaXML(malId: number, progress: number, status: MALMangaStatus, chapters: number, title: string): string;
|
|
35
35
|
declare function createAnimeListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
|
|
36
36
|
declare function createMangaListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
|
|
37
|
-
|
|
37
|
+
declare function getCurrentPackageVersion(): string | null;
|
|
38
|
+
declare function timestampToTimeAgo(timestamp: number): string;
|
|
39
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
|
package/bin/helpers/workers.js
CHANGED
|
@@ -11,6 +11,7 @@ import fs from "fs";
|
|
|
11
11
|
import { readdir, writeFile } from "fs/promises";
|
|
12
12
|
import inquirer from "inquirer";
|
|
13
13
|
import { parse } from "json2csv";
|
|
14
|
+
import { createRequire } from "module";
|
|
14
15
|
import open from "open";
|
|
15
16
|
import { homedir } from "os";
|
|
16
17
|
import { join } from "path";
|
|
@@ -140,9 +141,10 @@ function selectFile(fileType) {
|
|
|
140
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
142
|
try {
|
|
142
143
|
const files = yield listFilesInDownloadFolder();
|
|
144
|
+
console.log(getDownloadFolderPath());
|
|
143
145
|
// Filter to include only files, not directories, with the specified extension
|
|
144
146
|
const onlyFiles = files.filter((file) => {
|
|
145
|
-
const filePath =
|
|
147
|
+
const filePath = `${getDownloadFolderPath()}/${file}`; // Adjust this to the correct path
|
|
146
148
|
const isFile = fs.lstatSync(filePath).isFile(); // Check if it's a file
|
|
147
149
|
return isFile && file.endsWith(fileType);
|
|
148
150
|
});
|
|
@@ -279,4 +281,37 @@ function createMangaListXML(mediaWithProgress) {
|
|
|
279
281
|
</myanimelist>`;
|
|
280
282
|
});
|
|
281
283
|
}
|
|
282
|
-
|
|
284
|
+
function getCurrentPackageVersion() {
|
|
285
|
+
const require = createRequire(import.meta.url);
|
|
286
|
+
const packageJson = require("../../package.json");
|
|
287
|
+
const version = packageJson.version;
|
|
288
|
+
return version || null;
|
|
289
|
+
}
|
|
290
|
+
function timestampToTimeAgo(timestamp) {
|
|
291
|
+
const now = Math.floor(Date.now() / 1000);
|
|
292
|
+
const elapsed = now - timestamp;
|
|
293
|
+
if (elapsed < 60) {
|
|
294
|
+
return `${elapsed} second${elapsed === 1 ? "" : "s"} ago`;
|
|
295
|
+
}
|
|
296
|
+
else if (elapsed < 3600) {
|
|
297
|
+
const minutes = Math.floor(elapsed / 60);
|
|
298
|
+
return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
|
|
299
|
+
}
|
|
300
|
+
else if (elapsed < 86400) {
|
|
301
|
+
const hours = Math.floor(elapsed / 3600);
|
|
302
|
+
return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
303
|
+
}
|
|
304
|
+
else if (elapsed < 2592000) {
|
|
305
|
+
const days = Math.floor(elapsed / 86400);
|
|
306
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
307
|
+
}
|
|
308
|
+
else if (elapsed < 31536000) {
|
|
309
|
+
const months = Math.floor(elapsed / 2592000);
|
|
310
|
+
return `${months} month${months === 1 ? "" : "s"} ago`;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const years = Math.floor(elapsed / 31536000);
|
|
314
|
+
return `${years} year${years === 1 ? "" : "s"} ago`;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
|
package/bin/index.js
CHANGED
|
@@ -9,18 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { Command } from "commander";
|
|
12
|
-
import { createRequire } from "module";
|
|
13
12
|
import process from "process";
|
|
14
13
|
import { Auth } from "./helpers/auth.js";
|
|
15
14
|
import { AniList } from "./helpers/lists.js";
|
|
16
|
-
|
|
17
|
-
const packageJson = require("../package.json");
|
|
18
|
-
const version = packageJson.version;
|
|
15
|
+
import { getCurrentPackageVersion } from "./helpers/workers.js";
|
|
19
16
|
const cli = new Command();
|
|
20
17
|
cli
|
|
21
18
|
.name("anilist")
|
|
22
19
|
.description("Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.")
|
|
23
|
-
.version(
|
|
20
|
+
.version(getCurrentPackageVersion());
|
|
24
21
|
cli
|
|
25
22
|
.command("login")
|
|
26
23
|
.description("Login with AniList")
|
|
@@ -35,7 +32,7 @@ cli
|
|
|
35
32
|
}
|
|
36
33
|
}));
|
|
37
34
|
cli
|
|
38
|
-
.command("
|
|
35
|
+
.command("whoami")
|
|
39
36
|
.description("Get details of the logged in user")
|
|
40
37
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
38
|
yield Auth.Myself();
|
|
@@ -91,7 +88,7 @@ cli
|
|
|
91
88
|
.description("Delete entire collections of anime or manga")
|
|
92
89
|
.option("-a, --anime", "For anime list of authenticated user", false)
|
|
93
90
|
.option("-m, --manga", "For manga list of authenticated user", false)
|
|
94
|
-
.option("-
|
|
91
|
+
.option("-s, --activity", "For activity of authenticated user", false)
|
|
95
92
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
|
|
96
93
|
const selectedOptions = [anime, manga, activity].filter(Boolean).length;
|
|
97
94
|
if (selectedOptions === 0) {
|
|
@@ -206,4 +203,11 @@ cli
|
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
}));
|
|
206
|
+
cli
|
|
207
|
+
.command("autolike")
|
|
208
|
+
.alias("al")
|
|
209
|
+
.description("Autolike following or global activities.")
|
|
210
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
|
+
yield Auth.AutoLike();
|
|
212
|
+
}));
|
|
209
213
|
cli.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,75 +1,80 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@irfanshadikrishad/anilist",
|
|
3
|
-
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
|
-
"author": "Irfan Shadik Rishad",
|
|
5
|
-
"version": "1.1.
|
|
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 lint && npm run lint:fix && npm run format",
|
|
23
|
-
"test": "
|
|
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
|
-
"@eslint/js": "^9.17.0",
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@irfanshadikrishad/anilist",
|
|
3
|
+
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
|
+
"author": "Irfan Shadik Rishad",
|
|
5
|
+
"version": "1.2.1-forbidden.1",
|
|
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 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
|
+
"@eslint/js": "^9.17.0",
|
|
58
|
+
"@types/jest": "^29.5.14",
|
|
59
|
+
"@types/json2csv": "^5.0.7",
|
|
60
|
+
"@types/node": "^22.10.5",
|
|
61
|
+
"eslint": "^9.17.0",
|
|
62
|
+
"globals": "^15.14.0",
|
|
63
|
+
"jest": "^29.7.0",
|
|
64
|
+
"prettier": "^3.4.2",
|
|
65
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
66
|
+
"ts-jest": "^29.2.5",
|
|
67
|
+
"ts-node": "^10.9.2",
|
|
68
|
+
"typescript": "^5.7.2",
|
|
69
|
+
"@babel/preset-env": "^7.26.0",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.19.0"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"commander": "^13.0.0",
|
|
74
|
+
"fast-xml-parser": "^4.5.1",
|
|
75
|
+
"inquirer": "^12.3.0",
|
|
76
|
+
"json2csv": "^6.0.0-alpha.2",
|
|
77
|
+
"node-fetch": "^3.3.2",
|
|
78
|
+
"open": "^10.1.0"
|
|
79
|
+
}
|
|
80
|
+
}
|
/package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|