@irfanshadikrishad/anilist 1.7.0 → 2.0.0-forbidden

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.
@@ -4,8 +4,8 @@ declare const deleteActivityMutation = "\nmutation($id: Int!) { DeleteActivity(i
4
4
  declare const saveTextActivityMutation = "\nmutation SaveTextActivity($status: String!) { SaveTextActivity(text: $status) { id text userId createdAt } }\n";
5
5
  declare const saveAnimeWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {\n SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {\n id progress hiddenFromStatusLists\n }\n}\n";
6
6
  declare const saveMangaWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {\n SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private\n ) { id progress hiddenFromStatusLists private }\n}\n";
7
+ declare const likeActivityMutation = "\nmutation($activityId: Int!) {\n ToggleLike(id: $activityId, type: ACTIVITY) { id }\n}\n";
7
8
  declare const toggleFollowMutation = "mutation ($userId: Int!) { ToggleFollow(userId: $userId) { id name isFollower isFollowing } }";
8
9
  declare const deleteMediaEntryMutation = "mutation($id: Int!) { DeleteMediaListEntry(id: $id) { deleted } }";
9
10
  declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
10
- declare const moveListMutation = "mutation ($mediaId: Int, $status: MediaListStatus, $customList: String) {\n SaveMediaListEntry(\n mediaId: $mediaId\n status: $status\n customLists: [$customList]\n hiddenFromStatusLists: true\n ) { id status hiddenFromStatusLists customLists media { title { romaji english native userPreferred } } }\n}";
11
- export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, moveListMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
11
+ export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, likeActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
@@ -29,17 +29,14 @@ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromSt
29
29
  ) { id progress hiddenFromStatusLists private }
30
30
  }
31
31
  `;
32
+ const likeActivityMutation = `
33
+ mutation($activityId: Int!) {
34
+ ToggleLike(id: $activityId, type: ACTIVITY) { id }
35
+ }
36
+ `;
32
37
  const toggleFollowMutation = `mutation ($userId: Int!) { ToggleFollow(userId: $userId) { id name isFollower isFollowing } }`;
33
38
  const deleteMediaEntryMutation = `mutation($id: Int!) { DeleteMediaListEntry(id: $id) { deleted } }`;
34
39
  const deleteMangaEntryMutation = `mutation($id: Int) {
35
40
  DeleteMediaListEntry(id: $id) { deleted }
36
41
  }`;
37
- const moveListMutation = `mutation ($mediaId: Int, $status: MediaListStatus, $customList: String) {
38
- SaveMediaListEntry(
39
- mediaId: $mediaId
40
- status: $status
41
- customLists: [$customList]
42
- hiddenFromStatusLists: true
43
- ) { id status hiddenFromStatusLists customLists media { title { romaji english native userPreferred } } }
44
- }`;
45
- export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, moveListMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
42
+ export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, likeActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
@@ -17,7 +17,10 @@ declare const activityAllQuery = "query ($userId: Int, $page: Int, $perPage: Int
17
17
  declare const activityMediaList = "query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {\n Page(page: $page, perPage: $perPage) {\n pageInfo { total currentPage lastPage hasNextPage perPage }\n activities(userId: $userId, type: $type, sort: ID_DESC) {\n ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }\n }\n }\n}";
18
18
  declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $malId, type: ANIME) { id title { romaji english } } }\n";
19
19
  declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $malId, type: MANGA) { id title { romaji english } } }\n";
20
+ declare const followingActivitiesQuery = "\nquery ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(isFollowing: true, sort: ID_DESC) {\n ... on TextActivity { id type isLiked createdAt user { id name } }\n ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }\n ... on MessageActivity { id type isLiked message createdAt recipient { id name } }\n }\n }\n}\n";
21
+ declare const globalActivitiesQuery = "\nquery ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(sort: ID_DESC) {\n ... on TextActivity { id type isLiked createdAt user { id name } }\n ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }\n ... on MessageActivity { id type isLiked message createdAt recipient { id name } }\n }\n }\n}\n";
22
+ declare const specificUserActivitiesQuery = "\nquery ($page: Int, $perPage: Int, $userId: Int) {\n Page(page: $page, perPage: $perPage) {\n pageInfo { total perPage currentPage lastPage hasNextPage }\n activities(userId: $userId, sort: ID_DESC) {\n ... on TextActivity { id type isLiked createdAt user { id name } }\n ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }\n ... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }\n }\n }\n}\n";
20
23
  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";
21
24
  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";
22
25
  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";
23
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
26
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -119,6 +119,40 @@ const malIdToAnilistAnimeId = `query ($malId: Int) {
119
119
  const malIdToAnilistMangaId = `query ($malId: Int) {
120
120
  Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
121
121
  `;
122
+ const followingActivitiesQuery = `
123
+ query ($page: Int, $perPage: Int) {
124
+ Page(page: $page, perPage: $perPage) {
125
+ activities(isFollowing: true, sort: ID_DESC) {
126
+ ... on TextActivity { id type isLiked createdAt user { id name } }
127
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
128
+ ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
129
+ }
130
+ }
131
+ }
132
+ `;
133
+ const globalActivitiesQuery = `
134
+ query ($page: Int, $perPage: Int) {
135
+ Page(page: $page, perPage: $perPage) {
136
+ activities(sort: ID_DESC) {
137
+ ... on TextActivity { id type isLiked createdAt user { id name } }
138
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
139
+ ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
140
+ }
141
+ }
142
+ }
143
+ `;
144
+ const specificUserActivitiesQuery = `
145
+ query ($page: Int, $perPage: Int, $userId: Int) {
146
+ Page(page: $page, perPage: $perPage) {
147
+ pageInfo { total perPage currentPage lastPage hasNextPage }
148
+ activities(userId: $userId, sort: ID_DESC) {
149
+ ... on TextActivity { id type isLiked createdAt user { id name } }
150
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
151
+ ... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }
152
+ }
153
+ }
154
+ }
155
+ `;
122
156
  const userFollowingQuery = `query ($userId: Int!, $page: Int) {
123
157
  Page (page: $page) {
124
158
  pageInfo { total perPage currentPage lastPage hasNextPage }
@@ -141,4 +175,4 @@ const mangaDetailsQuery = `query ($id: Int) {
141
175
  }
142
176
  }
143
177
  `;
144
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
178
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -1,5 +1,5 @@
1
- import cliTruncate from "cli-truncate";
2
- import process from "process";
1
+ import cliTruncate from 'cli-truncate';
2
+ import process from 'process';
3
3
  /**
4
4
  * Truncate text (No line break)
5
5
  * @param str - Long text to trancate
@@ -323,6 +323,58 @@ type Activity = {
323
323
  };
324
324
  createdAt: number;
325
325
  };
326
+ interface TheActivity {
327
+ type: string;
328
+ id: number;
329
+ message?: string;
330
+ createdAt: number;
331
+ recipient?: {
332
+ id: number;
333
+ name: string;
334
+ };
335
+ isLiked?: boolean;
336
+ user?: {
337
+ id?: number;
338
+ name?: string;
339
+ };
340
+ messenger?: {
341
+ name: string;
342
+ };
343
+ media?: {
344
+ title?: {
345
+ userPreferred: string;
346
+ };
347
+ };
348
+ progress?: string | null;
349
+ status?: string;
350
+ }
351
+ type LikeActivityResponse = {
352
+ data?: {
353
+ ToggleLike: {
354
+ id: number;
355
+ };
356
+ };
357
+ errors?: {
358
+ message: string;
359
+ }[];
360
+ };
361
+ type SpecificUserActivitiesResponse = {
362
+ data?: {
363
+ Page: {
364
+ pageInfo: {
365
+ total: number;
366
+ perPage: number;
367
+ currentPage: number;
368
+ lastPage: number;
369
+ hasNextPage: boolean;
370
+ };
371
+ activities: TheActivity[];
372
+ };
373
+ };
374
+ errors?: {
375
+ message: string;
376
+ }[];
377
+ };
326
378
  type CoverImage = {
327
379
  color: string;
328
380
  medium: string;
@@ -347,18 +399,4 @@ type MangaDetails = {
347
399
  };
348
400
  errors?: Error;
349
401
  };
350
- type MoveListsResponse = {
351
- data?: {
352
- SaveMediaListEntry: {
353
- id: 474487691;
354
- status: "COMPLETED";
355
- hiddenFromStatusLists: true;
356
- customLists: Record<string, boolean>;
357
- media: {
358
- title: MediaTitle;
359
- };
360
- };
361
- };
362
- errors?: Error;
363
- };
364
- export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MangaDetails, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, MoveListsResponse, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
402
+ 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, };
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { parseStringPromise } from "xml2js";
10
+ import { parseStringPromise } from 'xml2js';
11
11
  class Validate {
12
12
  /**
13
13
  * Validate importable JSON file
@@ -16,7 +16,7 @@ class Validate {
16
16
  */
17
17
  static Import_JSON(data) {
18
18
  return (Array.isArray(data) &&
19
- data.every((item) => typeof item === "object" && item !== null && "id" in item));
19
+ data.every((item) => typeof item === 'object' && item !== null && 'id' in item));
20
20
  }
21
21
  /**
22
22
  * Validate if MyAnimeList Anime XML file is valid or not
@@ -43,12 +43,12 @@ class Validate {
43
43
  return isValidId && hasRequiredFields;
44
44
  });
45
45
  if (!isValid) {
46
- console.error("Validation failed: Some anime entries are missing required fields or have invalid IDs.");
46
+ console.error('Validation failed: Some anime entries are missing required fields or have invalid IDs.');
47
47
  }
48
48
  return isValid;
49
49
  }
50
50
  catch (error) {
51
- console.error("Error parsing or validating XML:", error);
51
+ console.error('Error parsing or validating XML:', error);
52
52
  return false;
53
53
  }
54
54
  });
@@ -78,12 +78,12 @@ class Validate {
78
78
  return isValidId && hasRequiredFields;
79
79
  });
80
80
  if (!isValid) {
81
- console.error("Validation failed: Some manga entries are missing required fields or have invalid IDs.");
81
+ console.error('Validation failed: Some manga entries are missing required fields or have invalid IDs.');
82
82
  }
83
83
  return isValid;
84
84
  }
85
85
  catch (error) {
86
- console.error("Error parsing or validating XML:", error);
86
+ console.error('Error parsing or validating XML:', error);
87
87
  return false;
88
88
  }
89
89
  });
@@ -97,7 +97,7 @@ class Validate {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
98
  try {
99
99
  if (!(file === null || file === void 0 ? void 0 : file.trim())) {
100
- console.error("File content is empty or invalid.");
100
+ console.error('File content is empty or invalid.');
101
101
  return false;
102
102
  }
103
103
  const obj3ct = JSON.parse(file);
@@ -108,7 +108,7 @@ class Validate {
108
108
  return true;
109
109
  }
110
110
  catch (error) {
111
- console.error("Failed to parse JSON file:", error);
111
+ console.error('Failed to parse JSON file:', error);
112
112
  return false;
113
113
  }
114
114
  });
@@ -1,4 +1,4 @@
1
- import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress, User } from "./types.js";
1
+ import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity, User } 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: {
@@ -38,6 +38,7 @@ declare function createMangaListXML(mediaWithProgress: MediaWithProgress[]): Pro
38
38
  declare function getCurrentPackageVersion(): string | null;
39
39
  declare function timestampToTimeAgo(timestamp: number): string;
40
40
  declare const anidbToanilistMapper: (romanjiName: string, year: number, englishName?: string) => Promise<number | null>;
41
+ declare function activityBy(activity: TheActivity, count?: number): string;
41
42
  /**
42
43
  * Extract the save file path
43
44
  * @param data_type - anime|manga
@@ -48,4 +49,4 @@ declare function saveToPath(data_type: string, file_format: string): Promise<str
48
49
  declare function simpleDateFormat(date: DateMonthYear): string;
49
50
  declare function handleRateLimitRetry(retryCount: number): Promise<void>;
50
51
  declare function logUserDetails(user: User, followersCount: number, followingCount: number): void;
51
- export { anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, handleRateLimitRetry, logUserDetails, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
52
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, handleRateLimitRetry, logUserDetails, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };