@irfanshadikrishad/anilist 1.0.11 → 1.1.0-forbidden.7
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/LICENSE +373 -382
- package/LICENSE.md +382 -0
- package/README.md +87 -58
- package/bin/helpers/auth.d.ts +24 -8
- package/bin/helpers/auth.js +661 -258
- package/bin/helpers/fetcher.d.ts +2 -1
- package/bin/helpers/fetcher.js +14 -7
- package/bin/helpers/lists.d.ts +5 -1
- package/bin/helpers/lists.js +516 -405
- package/bin/helpers/mutations.d.ts +8 -4
- package/bin/helpers/mutations.js +14 -10
- package/bin/helpers/queries.d.ts +13 -9
- package/bin/helpers/queries.js +62 -16
- package/bin/helpers/truncate.d.ts +6 -0
- package/bin/helpers/truncate.js +10 -0
- package/bin/helpers/types.d.ts +319 -28
- package/bin/helpers/validation.d.ts +29 -0
- package/bin/helpers/validation.js +117 -0
- package/bin/helpers/workers.d.ts +24 -9
- package/bin/helpers/workers.js +210 -16
- package/bin/index.js +43 -4
- package/package.json +29 -16
- package/assets/binance.jpg +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
declare const addAnimeToListMutation = "\nmutation($mediaId: Int, $status: MediaListStatus) {\n SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }\n}\n";
|
|
2
|
-
declare const addMangaToListMutation = "\n mutation($mediaId: Int, $status: MediaListStatus) {\n SaveMediaListEntry(mediaId: $mediaId, status: $status) {\n id
|
|
3
|
-
declare const deleteActivityMutation = "\nmutation($id: Int!) {
|
|
4
|
-
declare const saveTextActivityMutation = "\nmutation SaveTextActivity($status: String!) {
|
|
2
|
+
declare const addMangaToListMutation = "\n mutation($mediaId: Int, $status: MediaListStatus) {\n SaveMediaListEntry(mediaId: $mediaId, status: $status) {\n id status media { id title { romaji english } }\n }\n }\n";
|
|
3
|
+
declare const deleteActivityMutation = "\nmutation($id: Int!) { DeleteActivity(id: $id) { deleted } }\n";
|
|
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
|
-
|
|
7
|
+
declare const likeActivityMutation = "\nmutation($activityId: Int!) {\n ToggleLike(id: $activityId, type: ACTIVITY) { id }\n}\n";
|
|
8
|
+
declare const toggleFollowMutation = "mutation ($userId: Int!) { ToggleFollow(userId: $userId) { id name isFollower isFollowing } }";
|
|
9
|
+
declare const deleteMediaEntryMutation = "mutation($id: Int!) { DeleteMediaListEntry(id: $id) { deleted } }";
|
|
10
|
+
declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
11
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, likeActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
|
package/bin/helpers/mutations.js
CHANGED
|
@@ -6,21 +6,15 @@ mutation($mediaId: Int, $status: MediaListStatus) {
|
|
|
6
6
|
const addMangaToListMutation = `
|
|
7
7
|
mutation($mediaId: Int, $status: MediaListStatus) {
|
|
8
8
|
SaveMediaListEntry(mediaId: $mediaId, status: $status) {
|
|
9
|
-
id
|
|
10
|
-
status
|
|
11
|
-
media { id title { romaji english } }
|
|
9
|
+
id status media { id title { romaji english } }
|
|
12
10
|
}
|
|
13
11
|
}
|
|
14
12
|
`;
|
|
15
13
|
const deleteActivityMutation = `
|
|
16
|
-
mutation($id: Int!) {
|
|
17
|
-
DeleteActivity(id: $id) { deleted }
|
|
18
|
-
}
|
|
14
|
+
mutation($id: Int!) { DeleteActivity(id: $id) { deleted } }
|
|
19
15
|
`;
|
|
20
16
|
const saveTextActivityMutation = `
|
|
21
|
-
mutation SaveTextActivity($status: String!) {
|
|
22
|
-
SaveTextActivity(text: $status) { id text userId createdAt }
|
|
23
|
-
}
|
|
17
|
+
mutation SaveTextActivity($status: String!) { SaveTextActivity(text: $status) { id text userId createdAt } }
|
|
24
18
|
`;
|
|
25
19
|
const saveAnimeWithProgressMutation = `
|
|
26
20
|
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
|
|
@@ -35,4 +29,14 @@ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromSt
|
|
|
35
29
|
) { id progress hiddenFromStatusLists private }
|
|
36
30
|
}
|
|
37
31
|
`;
|
|
38
|
-
|
|
32
|
+
const likeActivityMutation = `
|
|
33
|
+
mutation($activityId: Int!) {
|
|
34
|
+
ToggleLike(id: $activityId, type: ACTIVITY) { id }
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const toggleFollowMutation = `mutation ($userId: Int!) { ToggleFollow(userId: $userId) { id name isFollower isFollowing } }`;
|
|
38
|
+
const deleteMediaEntryMutation = `mutation($id: Int!) { DeleteMediaListEntry(id: $id) { deleted } }`;
|
|
39
|
+
const deleteMangaEntryMutation = `mutation($id: Int) {
|
|
40
|
+
DeleteMediaListEntry(id: $id) { deleted }
|
|
41
|
+
}`;
|
|
42
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, likeActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, toggleFollowMutation, };
|
package/bin/helpers/queries.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
declare const currentUserQuery = "{\n Viewer {\n id name about bans siteUrl options { profileColor timezone activityMergeTime }\n donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }\n moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }\n statistics { anime { count meanScore minutesWatched } manga { count chaptersRead volumesRead } }\n mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }\n }\n}";
|
|
1
|
+
declare const currentUserQuery = "{\n Viewer {\n id name about bans siteUrl options { profileColor timezone activityMergeTime }\n donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }\n moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }\n statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }\n mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }\n }\n}";
|
|
2
2
|
declare const trendingQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
3
3
|
declare const popularQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
4
4
|
declare const userQuery = "query ($username: String) {\n User(name: $username) {\n id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }\n isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }\n statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }\n }\n}";
|
|
5
|
-
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }\n }\n}\n";
|
|
6
|
-
declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }\n }\n}\n";
|
|
7
|
-
declare const deleteMediaEntryMutation = "mutation($id: Int!) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
8
|
-
declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
5
|
+
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }\n }\n}\n";
|
|
6
|
+
declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }\n }\n}\n";
|
|
9
7
|
declare const upcomingAnimesQuery = "query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {\n Page(perPage: $perPage) {\n media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {\n id title { romaji english native userPreferred } season seasonYear startDate { year month day }\n episodes description genres\n }\n }\n}";
|
|
10
8
|
declare const animeDetailsQuery = "query ($id: Int) {\n Media(id: $id) {\n id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }\n duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl\n stats { scoreDistribution { score amount } statusDistribution { status amount } }\n }\n}";
|
|
11
9
|
declare const userActivityQuery = "query ($id: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {\n ... on ListActivity { id status progress createdAt media { id title { romaji english } } }\n }\n }\n}";
|
|
12
|
-
declare const animeSearchQuery = "query ($search: String, $perPage: Int) {\n Page(perPage: $perPage) {\n media(search: $search, type: ANIME) { id title { romaji english native userPreferred } episodes status description }\n }\n}";
|
|
10
|
+
declare const animeSearchQuery = "query ($search: String, $perPage: Int) {\n Page(perPage: $perPage) {\n media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }\n }\n}";
|
|
13
11
|
declare const mangaSearchQuery = "query ($search: String, $perPage: Int) {\n Page(perPage: $perPage) {\n media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }\n }\n}";
|
|
14
12
|
declare const activityTextQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: TEXT, sort: ID_DESC) {\n ... on TextActivity { id type text createdAt user { id name } }\n }\n }\n}";
|
|
15
13
|
declare const activityAnimeListQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n }\n }\n}";
|
|
@@ -17,6 +15,12 @@ declare const activityMangaListQuery = "query ($userId: Int, $page: Int, $perPag
|
|
|
17
15
|
declare const activityMessageQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
18
16
|
declare const activityAllQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, sort: ID_DESC) {\n ... on TextActivity { id type text createdAt user { id name } }\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
19
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}";
|
|
20
|
-
declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $malId, type: ANIME) {
|
|
21
|
-
declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $malId, type: MANGA) {
|
|
22
|
-
|
|
18
|
+
declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $malId, type: ANIME) { id title { romaji english } } }\n";
|
|
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";
|
|
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";
|
|
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";
|
|
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";
|
|
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, };
|
package/bin/helpers/queries.js
CHANGED
|
@@ -3,7 +3,7 @@ const currentUserQuery = `{
|
|
|
3
3
|
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
4
|
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
|
|
5
5
|
moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
|
|
6
|
-
statistics { anime { count meanScore minutesWatched } manga { count chaptersRead volumesRead } }
|
|
6
|
+
statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
|
|
7
7
|
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
8
8
|
}
|
|
9
9
|
}`;
|
|
@@ -26,22 +26,16 @@ const userQuery = `query ($username: String) {
|
|
|
26
26
|
}`;
|
|
27
27
|
const currentUserAnimeList = `query ($id: Int) {
|
|
28
28
|
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
-
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }
|
|
29
|
+
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
const currentUserMangaList = `query ($id: Int) {
|
|
34
34
|
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
-
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }
|
|
35
|
+
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
`;
|
|
39
|
-
const deleteMediaEntryMutation = `mutation($id: Int!) {
|
|
40
|
-
DeleteMediaListEntry(id: $id) { deleted }
|
|
41
|
-
}`;
|
|
42
|
-
const deleteMangaEntryMutation = `mutation($id: Int) {
|
|
43
|
-
DeleteMediaListEntry(id: $id) { deleted }
|
|
44
|
-
}`;
|
|
45
39
|
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
46
40
|
Page(perPage: $perPage) {
|
|
47
41
|
media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
|
|
@@ -66,7 +60,7 @@ const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
|
|
|
66
60
|
}`;
|
|
67
61
|
const animeSearchQuery = `query ($search: String, $perPage: Int) {
|
|
68
62
|
Page(perPage: $perPage) {
|
|
69
|
-
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } episodes status description }
|
|
63
|
+
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
|
|
70
64
|
}
|
|
71
65
|
}`;
|
|
72
66
|
const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
@@ -120,13 +114,65 @@ const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type
|
|
|
120
114
|
}
|
|
121
115
|
}`;
|
|
122
116
|
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
-
Media(idMal: $malId, type: ANIME) {
|
|
124
|
-
id title { romaji english } }
|
|
125
|
-
}
|
|
117
|
+
Media(idMal: $malId, type: ANIME) { id title { romaji english } } }
|
|
126
118
|
`;
|
|
127
119
|
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
-
Media(idMal: $malId, type: MANGA) {
|
|
129
|
-
|
|
120
|
+
Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
|
|
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
|
+
`;
|
|
156
|
+
const userFollowingQuery = `query ($userId: Int!, $page: Int) {
|
|
157
|
+
Page (page: $page) {
|
|
158
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
159
|
+
following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
163
|
+
const userFollowersQuery = `query ($userId: Int!, $page: Int) {
|
|
164
|
+
Page (page: $page) {
|
|
165
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
166
|
+
followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
const mangaDetailsQuery = `query ($id: Int) {
|
|
171
|
+
Media(id: $id, type: MANGA) {
|
|
172
|
+
id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
|
|
173
|
+
bannerImage description chapters volumes status genres
|
|
174
|
+
startDate { year month day } endDate { year month day }
|
|
175
|
+
}
|
|
130
176
|
}
|
|
131
177
|
`;
|
|
132
|
-
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery,
|
|
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, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import cliTruncate from "cli-truncate";
|
|
2
|
+
import process from "process";
|
|
3
|
+
/**
|
|
4
|
+
* Truncate text (No line break)
|
|
5
|
+
* @param str - Long text to trancate
|
|
6
|
+
*/
|
|
7
|
+
function responsiveOutput(str) {
|
|
8
|
+
console.log(cliTruncate(str, process.stdout.columns - 5));
|
|
9
|
+
}
|
|
10
|
+
export { responsiveOutput };
|
package/bin/helpers/types.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
type Error = {
|
|
2
|
+
message: string;
|
|
3
|
+
}[];
|
|
1
4
|
interface DeleteMangaResponse {
|
|
2
5
|
data?: {
|
|
3
6
|
DeleteMediaListEntry?: {
|
|
4
7
|
deleted?: boolean;
|
|
5
8
|
};
|
|
6
9
|
};
|
|
7
|
-
errors?:
|
|
8
|
-
message: string;
|
|
9
|
-
}[];
|
|
10
|
+
errors?: Error;
|
|
10
11
|
}
|
|
11
12
|
declare enum AniListMediaStatus {
|
|
12
13
|
CURRENT = "CURRENT",
|
|
@@ -45,15 +46,10 @@ interface MalIdToAnilistIdResponse {
|
|
|
45
46
|
data?: {
|
|
46
47
|
Media: {
|
|
47
48
|
id: number;
|
|
48
|
-
title:
|
|
49
|
-
english?: string;
|
|
50
|
-
romaji?: string;
|
|
51
|
-
};
|
|
49
|
+
title: MediaTitle;
|
|
52
50
|
};
|
|
53
51
|
};
|
|
54
|
-
errors?:
|
|
55
|
-
message: string;
|
|
56
|
-
}[];
|
|
52
|
+
errors?: Error;
|
|
57
53
|
}
|
|
58
54
|
interface saveAnimeWithProgressResponse {
|
|
59
55
|
data?: {
|
|
@@ -63,9 +59,7 @@ interface saveAnimeWithProgressResponse {
|
|
|
63
59
|
hiddenFromStatusLists: boolean;
|
|
64
60
|
};
|
|
65
61
|
};
|
|
66
|
-
errors?:
|
|
67
|
-
message: string;
|
|
68
|
-
}[];
|
|
62
|
+
errors?: Error;
|
|
69
63
|
}
|
|
70
64
|
declare enum MALAnimeStatus {
|
|
71
65
|
ON_HOLD = "On-Hold",
|
|
@@ -84,28 +78,325 @@ declare enum MALMangaStatus {
|
|
|
84
78
|
interface AnimeList {
|
|
85
79
|
data?: {
|
|
86
80
|
MediaListCollection: {
|
|
87
|
-
lists:
|
|
88
|
-
name: string;
|
|
89
|
-
entries: {
|
|
90
|
-
id: number;
|
|
91
|
-
progress: number;
|
|
92
|
-
}[];
|
|
93
|
-
}[];
|
|
81
|
+
lists: MediaList[];
|
|
94
82
|
};
|
|
95
83
|
};
|
|
96
|
-
errors?:
|
|
97
|
-
message: string;
|
|
98
|
-
}[];
|
|
84
|
+
errors?: Error;
|
|
99
85
|
}
|
|
100
86
|
interface MediaWithProgress {
|
|
101
|
-
malId
|
|
87
|
+
malId?: number;
|
|
102
88
|
progress: number;
|
|
103
89
|
status: string;
|
|
104
90
|
episodes?: number;
|
|
105
91
|
chapters?: number;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
format?: string;
|
|
93
|
+
title: MediaTitle;
|
|
94
|
+
}
|
|
95
|
+
interface MediaTitle {
|
|
96
|
+
english?: string;
|
|
97
|
+
romaji?: string;
|
|
98
|
+
native?: string;
|
|
99
|
+
userPreferred?: string;
|
|
100
|
+
}
|
|
101
|
+
interface Media {
|
|
102
|
+
id: number;
|
|
103
|
+
idMal?: number;
|
|
104
|
+
title: MediaTitle;
|
|
105
|
+
chapters?: number;
|
|
106
|
+
}
|
|
107
|
+
interface MediaEntry {
|
|
108
|
+
media: Media;
|
|
109
|
+
private: boolean;
|
|
110
|
+
progress: number;
|
|
111
|
+
status: string;
|
|
112
|
+
hiddenFromStatusLists: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface SaveTextActivityResponse {
|
|
115
|
+
data?: {
|
|
116
|
+
SaveTextActivity: {
|
|
117
|
+
id: number;
|
|
118
|
+
userId: number;
|
|
119
|
+
text: string;
|
|
120
|
+
createdAt: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
errors?: Error;
|
|
124
|
+
}
|
|
125
|
+
interface MediaListCollectionResponse {
|
|
126
|
+
data?: {
|
|
127
|
+
MediaListCollection: {
|
|
128
|
+
lists: MediaList[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
errors?: Error;
|
|
132
|
+
}
|
|
133
|
+
interface List {
|
|
134
|
+
name: string;
|
|
135
|
+
entries: MediaEntry[];
|
|
136
|
+
}
|
|
137
|
+
interface MediaList {
|
|
138
|
+
id(id: number | string): string;
|
|
139
|
+
title: MediaTitle;
|
|
140
|
+
name: string;
|
|
141
|
+
entries: MediaListEntry[];
|
|
142
|
+
}
|
|
143
|
+
interface Myself {
|
|
144
|
+
data?: {
|
|
145
|
+
Viewer: User;
|
|
146
|
+
};
|
|
147
|
+
errors?: Error;
|
|
148
|
+
}
|
|
149
|
+
interface DateMonthYear {
|
|
150
|
+
day?: number | null;
|
|
151
|
+
month?: number | null;
|
|
152
|
+
year?: number | null;
|
|
153
|
+
}
|
|
154
|
+
interface AnimeDetails {
|
|
155
|
+
data?: {
|
|
156
|
+
Media: {
|
|
157
|
+
id: number;
|
|
158
|
+
title: MediaTitle;
|
|
159
|
+
description: string;
|
|
160
|
+
duration: string;
|
|
161
|
+
startDate: DateMonthYear;
|
|
162
|
+
endDate: DateMonthYear;
|
|
163
|
+
countryOfOrigin: string;
|
|
164
|
+
isAdult: boolean;
|
|
165
|
+
status: string;
|
|
166
|
+
season: string;
|
|
167
|
+
format: string;
|
|
168
|
+
genres: [string];
|
|
169
|
+
siteUrl: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
errors?: Error;
|
|
173
|
+
}
|
|
174
|
+
interface SaveMediaListEntryResponse {
|
|
175
|
+
data?: {
|
|
176
|
+
SaveMediaListEntry: {
|
|
177
|
+
id: number;
|
|
178
|
+
status: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
errors?: Error;
|
|
182
|
+
}
|
|
183
|
+
interface MediaListEntry {
|
|
184
|
+
id?: number;
|
|
185
|
+
media: {
|
|
186
|
+
id?: number;
|
|
187
|
+
idMal?: number;
|
|
188
|
+
title?: MediaTitle;
|
|
189
|
+
episodes?: number;
|
|
190
|
+
siteUrl?: string;
|
|
191
|
+
chapters?: number;
|
|
192
|
+
format?: string;
|
|
193
|
+
};
|
|
194
|
+
progress?: number;
|
|
195
|
+
status?: string;
|
|
196
|
+
hiddenFromStatusLists?: boolean;
|
|
197
|
+
private?: boolean;
|
|
198
|
+
}
|
|
199
|
+
type UserActivitiesResponse = {
|
|
200
|
+
data?: {
|
|
201
|
+
Page: {
|
|
202
|
+
activities: Activity[];
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
errors?: Error;
|
|
206
|
+
};
|
|
207
|
+
type UserResponse = {
|
|
208
|
+
data?: {
|
|
209
|
+
User: User;
|
|
210
|
+
};
|
|
211
|
+
errors?: Error;
|
|
212
|
+
};
|
|
213
|
+
type Avatar = {
|
|
214
|
+
large?: string;
|
|
215
|
+
medium?: string;
|
|
216
|
+
};
|
|
217
|
+
type User = {
|
|
218
|
+
id: number;
|
|
219
|
+
name?: string;
|
|
220
|
+
avatar?: Avatar;
|
|
221
|
+
bannerImage?: string;
|
|
222
|
+
isFollower?: boolean;
|
|
223
|
+
isFollowing?: boolean;
|
|
224
|
+
siteUrl?: string;
|
|
225
|
+
donatorTier?: string;
|
|
226
|
+
donatorBadge?: string;
|
|
227
|
+
createdAt?: number;
|
|
228
|
+
updatedAt?: number;
|
|
229
|
+
isBlocked?: boolean;
|
|
230
|
+
unreadNotificationCount?: number;
|
|
231
|
+
options?: {
|
|
232
|
+
profileColor?: string;
|
|
233
|
+
timezone?: string;
|
|
234
|
+
activityMergeTime?: number;
|
|
235
|
+
};
|
|
236
|
+
statistics?: {
|
|
237
|
+
anime?: {
|
|
238
|
+
count?: number;
|
|
239
|
+
episodesWatched?: number;
|
|
240
|
+
minutesWatched?: number;
|
|
241
|
+
meanScore?: number;
|
|
242
|
+
};
|
|
243
|
+
manga?: {
|
|
244
|
+
count?: number;
|
|
245
|
+
chaptersRead?: number;
|
|
246
|
+
volumesRead?: number;
|
|
247
|
+
meanScore?: number;
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
type UserFollower = {
|
|
252
|
+
data?: {
|
|
253
|
+
Page: {
|
|
254
|
+
pageInfo: {
|
|
255
|
+
total: number;
|
|
256
|
+
perPage: number;
|
|
257
|
+
currentPage: number;
|
|
258
|
+
lastPage: number;
|
|
259
|
+
hasNextPage: boolean;
|
|
260
|
+
};
|
|
261
|
+
followers: User[];
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
errors?: Error;
|
|
265
|
+
};
|
|
266
|
+
type UserFollowing = {
|
|
267
|
+
data?: {
|
|
268
|
+
Page: {
|
|
269
|
+
pageInfo: {
|
|
270
|
+
total: number;
|
|
271
|
+
perPage: number;
|
|
272
|
+
currentPage: number;
|
|
273
|
+
lastPage: number;
|
|
274
|
+
hasNextPage: boolean;
|
|
275
|
+
};
|
|
276
|
+
following: User[];
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
errors?: Error;
|
|
280
|
+
};
|
|
281
|
+
type AnimeSearchResponse = {
|
|
282
|
+
data?: {
|
|
283
|
+
Page: {
|
|
284
|
+
media: {
|
|
285
|
+
id: number;
|
|
286
|
+
title: MediaTitle;
|
|
287
|
+
startDate: DateMonthYear;
|
|
288
|
+
episodes: number;
|
|
289
|
+
status: string;
|
|
290
|
+
description: string;
|
|
291
|
+
}[];
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
errors?: Error;
|
|
295
|
+
};
|
|
296
|
+
type ToggleFollowResponse = {
|
|
297
|
+
data?: {
|
|
298
|
+
ToggleFollow: {
|
|
299
|
+
id: number;
|
|
300
|
+
name: string;
|
|
301
|
+
isFollower: boolean;
|
|
302
|
+
isFollowing: boolean;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
errors?: Error;
|
|
306
|
+
};
|
|
307
|
+
type DeleteMediaListResponse = {
|
|
308
|
+
data?: {
|
|
309
|
+
DeleteMediaListEntry: {
|
|
310
|
+
deleted: boolean;
|
|
311
|
+
};
|
|
109
312
|
};
|
|
313
|
+
errors?: Error;
|
|
314
|
+
};
|
|
315
|
+
type Activity = {
|
|
316
|
+
id: number;
|
|
317
|
+
type: string;
|
|
318
|
+
status: string;
|
|
319
|
+
progress: number | null;
|
|
320
|
+
media: {
|
|
321
|
+
id?: number;
|
|
322
|
+
title: MediaTitle;
|
|
323
|
+
};
|
|
324
|
+
createdAt: number;
|
|
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;
|
|
110
350
|
}
|
|
111
|
-
|
|
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
|
+
};
|
|
378
|
+
type CoverImage = {
|
|
379
|
+
color: string;
|
|
380
|
+
medium: string;
|
|
381
|
+
large: string;
|
|
382
|
+
extraLarge: string;
|
|
383
|
+
};
|
|
384
|
+
type MangaDetails = {
|
|
385
|
+
data?: {
|
|
386
|
+
Media: {
|
|
387
|
+
id: number;
|
|
388
|
+
title: MediaTitle;
|
|
389
|
+
coverImage: CoverImage;
|
|
390
|
+
bannerImage: string;
|
|
391
|
+
description: string;
|
|
392
|
+
chapters: number | null;
|
|
393
|
+
volumes: number | null;
|
|
394
|
+
status: string;
|
|
395
|
+
genres: [string];
|
|
396
|
+
startDate: DateMonthYear;
|
|
397
|
+
endDate: DateMonthYear;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
errors?: Error;
|
|
401
|
+
};
|
|
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, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare class Validate {
|
|
2
|
+
/**
|
|
3
|
+
* Validate importable JSON file
|
|
4
|
+
* @param data string
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
static Import_JSON(data: {
|
|
8
|
+
id: number;
|
|
9
|
+
}[]): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate if MyAnimeList Anime XML file is valid or not
|
|
12
|
+
* @param xmlData string
|
|
13
|
+
* @returns boolean
|
|
14
|
+
*/
|
|
15
|
+
static Import_AnimeXML(xmlData: string): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Validate if MyAnimeList Anime XML file is valid or not
|
|
18
|
+
* @param xmlData string
|
|
19
|
+
* @returns boolean
|
|
20
|
+
*/
|
|
21
|
+
static Import_MangaXML(xmlData: string): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Validate AniDB json-large file
|
|
24
|
+
* @param file string of anidb json-large
|
|
25
|
+
* @returns boolean
|
|
26
|
+
*/
|
|
27
|
+
static Import_AniDBJSONLarge(file: string): Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
export { Validate };
|