@irfanshadikrishad/anilist 1.2.3 → 1.3.0-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.
@@ -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,139 @@ interface MediaWithProgress {
108
102
  romaji?: string;
109
103
  };
110
104
  }
111
- export { AniListMediaStatus, AnimeList, DeleteMangaResponse, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaWithProgress, saveAnimeWithProgressResponse, };
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
+ interface TheActivity {
216
+ type: string;
217
+ id: number;
218
+ message?: string;
219
+ createdAt: number;
220
+ recipient?: {
221
+ id: number;
222
+ name: string;
223
+ };
224
+ isLiked?: boolean;
225
+ user?: {
226
+ id?: number;
227
+ name?: string;
228
+ };
229
+ messenger?: {
230
+ name: string;
231
+ };
232
+ media?: {
233
+ title?: {
234
+ userPreferred: string;
235
+ };
236
+ };
237
+ progress?: string | null;
238
+ status?: string;
239
+ }
240
+ export { AniListMediaStatus, AnimeDetails, AnimeList, DateMonthYear, DeleteMangaResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListEntry, MediaTitle, MediaWithProgress, Myself, TheActivity, saveAnimeWithProgressResponse, };
@@ -1,4 +1,4 @@
1
- import { MALAnimeStatus, MALMangaStatus, MediaWithProgress } from "./types.js";
1
+ import { 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: {
@@ -35,4 +35,6 @@ declare function createMangaXML(malId: number, progress: number, status: MALMang
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
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
38
+ declare function timestampToTimeAgo(timestamp: number): string;
39
+ declare function activityBy(activity: TheActivity): string;
40
+ export { activityBy, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
@@ -17,7 +17,7 @@ import { homedir } from "os";
17
17
  import { join } from "path";
18
18
  import process from "process";
19
19
  import { Auth } from "./auth.js";
20
- import { MALAnimeStatus, MALMangaStatus } from "./types.js";
20
+ import { MALAnimeStatus, MALMangaStatus, } from "./types.js";
21
21
  const aniListEndpoint = `https://graphql.anilist.co`;
22
22
  const redirectUri = "https://anilist.co/api/v2/oauth/pin";
23
23
  function getTitle(title) {
@@ -287,4 +287,51 @@ function getCurrentPackageVersion() {
287
287
  const version = packageJson.version;
288
288
  return version || null;
289
289
  }
290
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
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
+ function activityBy(activity) {
318
+ var _a, _b, _c, _d;
319
+ if ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) {
320
+ return `[${activity.id}]\t${activity.messenger.name} messaged ${activity.recipient.name}`;
321
+ }
322
+ else if ((_c = (_b = activity === null || activity === void 0 ? void 0 : activity.media) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.userPreferred) {
323
+ if (activity.progress) {
324
+ return `[${activity.id}]\t${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
325
+ }
326
+ else {
327
+ return `[${activity.id}]\t${activity.status} ${activity.media.title.userPreferred}`;
328
+ }
329
+ }
330
+ else if ((_d = activity === null || activity === void 0 ? void 0 : activity.user) === null || _d === void 0 ? void 0 : _d.name) {
331
+ return `[${activity.id}]\t${activity.user.name}`;
332
+ }
333
+ else {
334
+ return `[${activity === null || activity === void 0 ? void 0 : activity.id}] ???`;
335
+ }
336
+ }
337
+ export { activityBy, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
package/bin/index.js CHANGED
@@ -32,7 +32,7 @@ cli
32
32
  }
33
33
  }));
34
34
  cli
35
- .command("me")
35
+ .command("whoami")
36
36
  .description("Get details of the logged in user")
37
37
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
38
38
  yield Auth.Myself();
@@ -88,7 +88,7 @@ cli
88
88
  .description("Delete entire collections of anime or manga")
89
89
  .option("-a, --anime", "For anime list of authenticated user", false)
90
90
  .option("-m, --manga", "For manga list of authenticated user", false)
91
- .option("-ac, --activity", "For activity of authenticated user", false)
91
+ .option("-s, --activity", "For activity of authenticated user", false)
92
92
  .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
93
93
  const selectedOptions = [anime, manga, activity].filter(Boolean).length;
94
94
  if (selectedOptions === 0) {
@@ -203,4 +203,11 @@ cli
203
203
  }
204
204
  }
205
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
+ }));
206
213
  cli.parse(process.argv);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@irfanshadikrishad/anilist",
3
3
  "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
4
  "author": "Irfan Shadik Rishad",
5
- "version": "1.2.3",
5
+ "version": "1.3.0-forbidden.1",
6
6
  "main": "./bin/index.js",
7
7
  "type": "module",
8
8
  "types": "./bin/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "format:check": "prettier . --check",
20
20
  "lint": "eslint ./dist",
21
21
  "lint:fix": "eslint ./dist --fix",
22
- "all": "npm run lint && npm run lint:fix && npm run format",
22
+ "all": "npm run lint && npm run lint:fix && npm run format && npm test",
23
23
  "test": "jest ./tests"
24
24
  },
25
25
  "keywords": [
@@ -57,7 +57,7 @@
57
57
  "@eslint/js": "^9.17.0",
58
58
  "@types/jest": "^29.5.14",
59
59
  "@types/json2csv": "^5.0.7",
60
- "@types/node": "^22.10.2",
60
+ "@types/node": "^22.10.5",
61
61
  "eslint": "^9.17.0",
62
62
  "globals": "^15.14.0",
63
63
  "jest": "^29.7.0",
@@ -67,10 +67,10 @@
67
67
  "ts-node": "^10.9.2",
68
68
  "typescript": "^5.7.2",
69
69
  "@babel/preset-env": "^7.26.0",
70
- "@typescript-eslint/eslint-plugin": "^8.19.0"
70
+ "@typescript-eslint/eslint-plugin": "^8.19.1"
71
71
  },
72
72
  "dependencies": {
73
- "commander": "^12.1.0",
73
+ "commander": "^13.0.0",
74
74
  "fast-xml-parser": "^4.5.1",
75
75
  "inquirer": "^12.3.0",
76
76
  "json2csv": "^6.0.0-alpha.2",
File without changes