@irfanshadikrishad/anilist 1.2.16 → 1.3.0-forbidden.6
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 -373
- package/LICENSE.md +382 -0
- package/bin/helpers/auth.d.ts +5 -0
- package/bin/helpers/auth.js +350 -33
- package/bin/helpers/lists.js +5 -4
- package/bin/helpers/mutations.d.ts +2 -1
- package/bin/helpers/mutations.js +37 -32
- package/bin/helpers/queries.d.ts +6 -3
- package/bin/helpers/queries.js +180 -150
- package/bin/helpers/truncate.d.ts +6 -0
- package/bin/helpers/truncate.js +10 -0
- package/bin/helpers/types.d.ts +53 -1
- package/bin/helpers/workers.d.ts +3 -2
- package/bin/helpers/workers.js +88 -68
- package/bin/index.js +7 -0
- package/package.json +16 -14
package/bin/helpers/queries.js
CHANGED
|
@@ -1,158 +1,188 @@
|
|
|
1
|
-
const currentUserQuery = `{
|
|
2
|
-
Viewer {
|
|
3
|
-
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
|
-
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
|
|
5
|
-
moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
|
|
6
|
-
statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
|
|
7
|
-
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
8
|
-
}
|
|
9
|
-
}`;
|
|
10
|
-
const trendingQuery = `query ($page: Int, $perPage: Int) {
|
|
11
|
-
Page(page: $page, perPage: $perPage) {
|
|
12
|
-
media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
|
|
13
|
-
}
|
|
14
|
-
}`;
|
|
15
|
-
const popularQuery = `query ($page: Int, $perPage: Int) {
|
|
16
|
-
Page(page: $page, perPage: $perPage) {
|
|
17
|
-
media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
|
|
18
|
-
}
|
|
19
|
-
}`;
|
|
20
|
-
const userQuery = `query ($username: String) {
|
|
21
|
-
User(name: $username) {
|
|
22
|
-
id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
|
|
23
|
-
isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
|
|
24
|
-
statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
|
|
25
|
-
}
|
|
26
|
-
}`;
|
|
27
|
-
const currentUserAnimeList = `query ($id: Int) {
|
|
28
|
-
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
-
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
const currentUserQuery = `{
|
|
2
|
+
Viewer {
|
|
3
|
+
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
|
+
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
|
|
5
|
+
moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
|
|
6
|
+
statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
|
|
7
|
+
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
8
|
+
}
|
|
9
|
+
}`;
|
|
10
|
+
const trendingQuery = `query ($page: Int, $perPage: Int) {
|
|
11
|
+
Page(page: $page, perPage: $perPage) {
|
|
12
|
+
media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
|
|
13
|
+
}
|
|
14
|
+
}`;
|
|
15
|
+
const popularQuery = `query ($page: Int, $perPage: Int) {
|
|
16
|
+
Page(page: $page, perPage: $perPage) {
|
|
17
|
+
media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
|
|
18
|
+
}
|
|
19
|
+
}`;
|
|
20
|
+
const userQuery = `query ($username: String) {
|
|
21
|
+
User(name: $username) {
|
|
22
|
+
id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
|
|
23
|
+
isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
|
|
24
|
+
statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
|
|
25
|
+
}
|
|
26
|
+
}`;
|
|
27
|
+
const currentUserAnimeList = `query ($id: Int) {
|
|
28
|
+
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
+
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
`;
|
|
33
|
-
const currentUserMangaList = `query ($id: Int) {
|
|
34
|
-
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
-
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
33
|
+
const currentUserMangaList = `query ($id: Int) {
|
|
34
|
+
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
+
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }
|
|
36
|
+
}
|
|
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
|
-
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
46
|
-
Page(perPage: $perPage) {
|
|
47
|
-
media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
|
|
48
|
-
id title { romaji english native userPreferred } season seasonYear startDate { year month day }
|
|
49
|
-
episodes description genres
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}`;
|
|
53
|
-
const animeDetailsQuery = `query ($id: Int) {
|
|
54
|
-
Media(id: $id) {
|
|
55
|
-
id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
|
|
56
|
-
duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
|
|
57
|
-
stats { scoreDistribution { score amount } statusDistribution { status amount } }
|
|
58
|
-
}
|
|
59
|
-
}`;
|
|
60
|
-
const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
|
|
61
|
-
Page(page: $page, perPage: $perPage) {
|
|
62
|
-
activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
|
|
63
|
-
... on ListActivity { id status progress createdAt media { id title { romaji english } } }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}`;
|
|
67
|
-
const animeSearchQuery = `query ($search: String, $perPage: Int) {
|
|
68
|
-
Page(perPage: $perPage) {
|
|
69
|
-
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
|
|
70
|
-
}
|
|
71
|
-
}`;
|
|
72
|
-
const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
73
|
-
Page(perPage: $perPage) {
|
|
74
|
-
media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
|
|
75
|
-
}
|
|
76
|
-
}`;
|
|
77
|
-
const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
78
|
-
Page(page: $page, perPage: $perPage) {
|
|
79
|
-
activities(userId: $userId, type: TEXT, sort: ID_DESC) {
|
|
80
|
-
... on TextActivity { id type text createdAt user { id name } }
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}`;
|
|
84
|
-
const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
85
|
-
Page(page: $page, perPage: $perPage) {
|
|
86
|
-
activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
|
|
87
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}`;
|
|
91
|
-
const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
92
|
-
Page(page: $page, perPage: $perPage) {
|
|
93
|
-
activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
|
|
94
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}`;
|
|
98
|
-
const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
99
|
-
Page(page: $page, perPage: $perPage) {
|
|
100
|
-
activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
|
|
101
|
-
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}`;
|
|
105
|
-
const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
106
|
-
Page(page: $page, perPage: $perPage) {
|
|
107
|
-
activities(userId: $userId, sort: ID_DESC) {
|
|
108
|
-
... on TextActivity { id type text createdAt user { id name } }
|
|
109
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
110
|
-
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}`;
|
|
114
|
-
const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
|
|
115
|
-
Page(page: $page, perPage: $perPage) {
|
|
116
|
-
pageInfo { total currentPage lastPage hasNextPage perPage }
|
|
117
|
-
activities(userId: $userId, type: $type, sort: ID_DESC) {
|
|
118
|
-
... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}`;
|
|
122
|
-
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
-
Media(idMal: $malId, type: ANIME) {
|
|
124
|
-
id title { romaji english } }
|
|
125
|
-
}
|
|
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
|
+
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
46
|
+
Page(perPage: $perPage) {
|
|
47
|
+
media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
|
|
48
|
+
id title { romaji english native userPreferred } season seasonYear startDate { year month day }
|
|
49
|
+
episodes description genres
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}`;
|
|
53
|
+
const animeDetailsQuery = `query ($id: Int) {
|
|
54
|
+
Media(id: $id) {
|
|
55
|
+
id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
|
|
56
|
+
duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
|
|
57
|
+
stats { scoreDistribution { score amount } statusDistribution { status amount } }
|
|
58
|
+
}
|
|
59
|
+
}`;
|
|
60
|
+
const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
|
|
61
|
+
Page(page: $page, perPage: $perPage) {
|
|
62
|
+
activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
|
|
63
|
+
... on ListActivity { id status progress createdAt media { id title { romaji english } } }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}`;
|
|
67
|
+
const animeSearchQuery = `query ($search: String, $perPage: Int) {
|
|
68
|
+
Page(perPage: $perPage) {
|
|
69
|
+
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
|
|
70
|
+
}
|
|
71
|
+
}`;
|
|
72
|
+
const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
73
|
+
Page(perPage: $perPage) {
|
|
74
|
+
media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
|
|
75
|
+
}
|
|
76
|
+
}`;
|
|
77
|
+
const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
78
|
+
Page(page: $page, perPage: $perPage) {
|
|
79
|
+
activities(userId: $userId, type: TEXT, sort: ID_DESC) {
|
|
80
|
+
... on TextActivity { id type text createdAt user { id name } }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}`;
|
|
84
|
+
const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
85
|
+
Page(page: $page, perPage: $perPage) {
|
|
86
|
+
activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
|
|
87
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}`;
|
|
91
|
+
const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
92
|
+
Page(page: $page, perPage: $perPage) {
|
|
93
|
+
activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
|
|
94
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}`;
|
|
98
|
+
const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
99
|
+
Page(page: $page, perPage: $perPage) {
|
|
100
|
+
activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
|
|
101
|
+
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}`;
|
|
105
|
+
const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
106
|
+
Page(page: $page, perPage: $perPage) {
|
|
107
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
108
|
+
... on TextActivity { id type text createdAt user { id name } }
|
|
109
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
110
|
+
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}`;
|
|
114
|
+
const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
|
|
115
|
+
Page(page: $page, perPage: $perPage) {
|
|
116
|
+
pageInfo { total currentPage lastPage hasNextPage perPage }
|
|
117
|
+
activities(userId: $userId, type: $type, sort: ID_DESC) {
|
|
118
|
+
... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}`;
|
|
122
|
+
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
+
Media(idMal: $malId, type: ANIME) { id title { romaji english } } }
|
|
126
124
|
`;
|
|
127
|
-
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
-
Media(idMal: $malId, type: MANGA) {
|
|
129
|
-
id title { romaji english } }
|
|
130
|
-
}
|
|
125
|
+
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
126
|
+
Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
|
|
131
127
|
`;
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
128
|
+
const followingActivitiesQuery = `
|
|
129
|
+
query ($page: Int, $perPage: Int) {
|
|
130
|
+
Page(page: $page, perPage: $perPage) {
|
|
131
|
+
activities(isFollowing: true, sort: ID_DESC) {
|
|
132
|
+
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
133
|
+
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
134
|
+
... on MessageActivity { id type isLiked message createdAt recipient { id name } }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
138
|
`;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
139
|
+
const globalActivitiesQuery = `
|
|
140
|
+
query ($page: Int, $perPage: Int) {
|
|
141
|
+
Page(page: $page, perPage: $perPage) {
|
|
142
|
+
activities(sort: ID_DESC) {
|
|
143
|
+
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
144
|
+
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
145
|
+
... on MessageActivity { id type isLiked message createdAt recipient { id name } }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
145
149
|
`;
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
const specificUserActivitiesQuery = `
|
|
151
|
+
query ($page: Int, $perPage: Int, $userId: Int) {
|
|
152
|
+
Page(page: $page, perPage: $perPage) {
|
|
153
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
154
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
155
|
+
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
156
|
+
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
157
|
+
... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
149
161
|
`;
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
162
|
+
const userFollowingQuery = `query ($userId: Int!, $page: Int) {
|
|
163
|
+
Page (page: $page) {
|
|
164
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
165
|
+
following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
166
|
+
}
|
|
167
|
+
}
|
|
157
168
|
`;
|
|
158
|
-
|
|
169
|
+
const userFollowersQuery = `query ($userId: Int!, $page: Int) {
|
|
170
|
+
Page (page: $page) {
|
|
171
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
172
|
+
followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`;
|
|
176
|
+
const toggleFollowMutation = `mutation ($userId: Int!) {
|
|
177
|
+
ToggleFollow(userId: $userId) { id name isFollower isFollowing }
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
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, };
|
|
@@ -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
|
@@ -380,6 +380,58 @@ type Activity = {
|
|
|
380
380
|
};
|
|
381
381
|
createdAt: number;
|
|
382
382
|
};
|
|
383
|
+
interface TheActivity {
|
|
384
|
+
type: string;
|
|
385
|
+
id: number;
|
|
386
|
+
message?: string;
|
|
387
|
+
createdAt: number;
|
|
388
|
+
recipient?: {
|
|
389
|
+
id: number;
|
|
390
|
+
name: string;
|
|
391
|
+
};
|
|
392
|
+
isLiked?: boolean;
|
|
393
|
+
user?: {
|
|
394
|
+
id?: number;
|
|
395
|
+
name?: string;
|
|
396
|
+
};
|
|
397
|
+
messenger?: {
|
|
398
|
+
name: string;
|
|
399
|
+
};
|
|
400
|
+
media?: {
|
|
401
|
+
title?: {
|
|
402
|
+
userPreferred: string;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
progress?: string | null;
|
|
406
|
+
status?: string;
|
|
407
|
+
}
|
|
408
|
+
type LikeActivityResponse = {
|
|
409
|
+
data?: {
|
|
410
|
+
ToggleLike: {
|
|
411
|
+
id: number;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
errors?: {
|
|
415
|
+
message: string;
|
|
416
|
+
}[];
|
|
417
|
+
};
|
|
418
|
+
type SpecificUserActivitiesResponse = {
|
|
419
|
+
data?: {
|
|
420
|
+
Page: {
|
|
421
|
+
pageInfo: {
|
|
422
|
+
total: number;
|
|
423
|
+
perPage: number;
|
|
424
|
+
currentPage: number;
|
|
425
|
+
lastPage: number;
|
|
426
|
+
hasNextPage: boolean;
|
|
427
|
+
};
|
|
428
|
+
activities: TheActivity[];
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
errors?: {
|
|
432
|
+
message: string;
|
|
433
|
+
}[];
|
|
434
|
+
};
|
|
383
435
|
type Error = {
|
|
384
436
|
message: string;
|
|
385
437
|
}[];
|
|
@@ -407,4 +459,4 @@ type MangaDetails = {
|
|
|
407
459
|
};
|
|
408
460
|
errors?: Error;
|
|
409
461
|
};
|
|
410
|
-
export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MangaDetails, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
|
|
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, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress } 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: {
|
|
@@ -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
|
|
@@ -46,4 +47,4 @@ declare const anidbToanilistMapper: (romanjiName: string, year: number, englishN
|
|
|
46
47
|
*/
|
|
47
48
|
declare function saveToPath(data_type: string, file_format: string): Promise<string>;
|
|
48
49
|
declare function simpleDateFormat(date: DateMonthYear): string;
|
|
49
|
-
export { anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
|
|
50
|
+
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/helpers/workers.js
CHANGED
|
@@ -202,49 +202,49 @@ function selectFile(fileType) {
|
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
function createAnimeXML(malId, progress, status, episodes, title, format) {
|
|
205
|
-
return `
|
|
206
|
-
<anime>
|
|
207
|
-
<series_animedb_id>${malId}</series_animedb_id>
|
|
208
|
-
<series_title><![CDATA[${title}]]></series_title>
|
|
209
|
-
<series_type>${format}</series_type>
|
|
210
|
-
<series_episodes>${episodes}</series_episodes>
|
|
211
|
-
<my_id>0</my_id>
|
|
212
|
-
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
213
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
214
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
215
|
-
<my_score>0</my_score>
|
|
216
|
-
<my_storage_value>0.00</my_storage_value>
|
|
217
|
-
<my_status>${status}</my_status>
|
|
218
|
-
<my_comments><![CDATA[]]></my_comments>
|
|
219
|
-
<my_times_watched>0</my_times_watched>
|
|
220
|
-
<my_rewatch_value></my_rewatch_value>
|
|
221
|
-
<my_priority>LOW</my_priority>
|
|
222
|
-
<my_tags><![CDATA[]]></my_tags>
|
|
223
|
-
<my_rewatching>0</my_rewatching>
|
|
224
|
-
<my_rewatching_ep>0</my_rewatching_ep>
|
|
225
|
-
<my_discuss>0</my_discuss>
|
|
226
|
-
<my_sns>default</my_sns>
|
|
227
|
-
<update_on_import>1</update_on_import>
|
|
205
|
+
return `
|
|
206
|
+
<anime>
|
|
207
|
+
<series_animedb_id>${malId}</series_animedb_id>
|
|
208
|
+
<series_title><![CDATA[${title}]]></series_title>
|
|
209
|
+
<series_type>${format}</series_type>
|
|
210
|
+
<series_episodes>${episodes}</series_episodes>
|
|
211
|
+
<my_id>0</my_id>
|
|
212
|
+
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
213
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
214
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
215
|
+
<my_score>0</my_score>
|
|
216
|
+
<my_storage_value>0.00</my_storage_value>
|
|
217
|
+
<my_status>${status}</my_status>
|
|
218
|
+
<my_comments><![CDATA[]]></my_comments>
|
|
219
|
+
<my_times_watched>0</my_times_watched>
|
|
220
|
+
<my_rewatch_value></my_rewatch_value>
|
|
221
|
+
<my_priority>LOW</my_priority>
|
|
222
|
+
<my_tags><![CDATA[]]></my_tags>
|
|
223
|
+
<my_rewatching>0</my_rewatching>
|
|
224
|
+
<my_rewatching_ep>0</my_rewatching_ep>
|
|
225
|
+
<my_discuss>0</my_discuss>
|
|
226
|
+
<my_sns>default</my_sns>
|
|
227
|
+
<update_on_import>1</update_on_import>
|
|
228
228
|
</anime>`;
|
|
229
229
|
}
|
|
230
230
|
function createMangaXML(malId, progress, status, chapters, title) {
|
|
231
|
-
return `
|
|
232
|
-
<manga>
|
|
233
|
-
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
234
|
-
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
235
|
-
<manga_volumes>0</manga_volumes>
|
|
236
|
-
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
237
|
-
<my_id>0</my_id>
|
|
238
|
-
<my_read_chapters>${progress}</my_read_chapters>
|
|
239
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
240
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
241
|
-
<my_score>0</my_score>
|
|
242
|
-
<my_status>${status}</my_status>
|
|
243
|
-
<my_reread_value></my_reread_value>
|
|
244
|
-
<my_priority>LOW</my_priority>
|
|
245
|
-
<my_rereading>0</my_rereading>
|
|
246
|
-
<my_discuss>0</my_discuss>
|
|
247
|
-
<update_on_import>1</update_on_import>
|
|
231
|
+
return `
|
|
232
|
+
<manga>
|
|
233
|
+
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
234
|
+
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
235
|
+
<manga_volumes>0</manga_volumes>
|
|
236
|
+
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
237
|
+
<my_id>0</my_id>
|
|
238
|
+
<my_read_chapters>${progress}</my_read_chapters>
|
|
239
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
240
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
241
|
+
<my_score>0</my_score>
|
|
242
|
+
<my_status>${status}</my_status>
|
|
243
|
+
<my_reread_value></my_reread_value>
|
|
244
|
+
<my_priority>LOW</my_priority>
|
|
245
|
+
<my_rereading>0</my_rereading>
|
|
246
|
+
<my_discuss>0</my_discuss>
|
|
247
|
+
<update_on_import>1</update_on_import>
|
|
248
248
|
</manga>`;
|
|
249
249
|
}
|
|
250
250
|
function createAnimeListXML(mediaWithProgress) {
|
|
@@ -259,7 +259,6 @@ function createAnimeListXML(mediaWithProgress) {
|
|
|
259
259
|
// Filter out anime without malId
|
|
260
260
|
const filteredMedia = mediaWithProgress.filter((anime) => anime.malId);
|
|
261
261
|
const xmlEntries = filteredMedia.map((anime) => {
|
|
262
|
-
console.log(anime);
|
|
263
262
|
const malId = anime.malId;
|
|
264
263
|
const progress = anime.progress;
|
|
265
264
|
const episodes = anime.episodes;
|
|
@@ -268,19 +267,19 @@ function createAnimeListXML(mediaWithProgress) {
|
|
|
268
267
|
const format = anime.format ? anime.format : "";
|
|
269
268
|
return createAnimeXML(malId, progress, status, episodes, title, format);
|
|
270
269
|
});
|
|
271
|
-
return `<myanimelist>
|
|
272
|
-
<myinfo>
|
|
273
|
-
<user_id/>
|
|
274
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
275
|
-
<user_export_type>1</user_export_type>
|
|
276
|
-
<user_total_anime>0</user_total_anime>
|
|
277
|
-
<user_total_watching>0</user_total_watching>
|
|
278
|
-
<user_total_completed>0</user_total_completed>
|
|
279
|
-
<user_total_onhold>0</user_total_onhold>
|
|
280
|
-
<user_total_dropped>0</user_total_dropped>
|
|
281
|
-
<user_total_plantowatch>0</user_total_plantowatch>
|
|
282
|
-
</myinfo>
|
|
283
|
-
\n${xmlEntries.join("\n")}\n
|
|
270
|
+
return `<myanimelist>
|
|
271
|
+
<myinfo>
|
|
272
|
+
<user_id/>
|
|
273
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
274
|
+
<user_export_type>1</user_export_type>
|
|
275
|
+
<user_total_anime>0</user_total_anime>
|
|
276
|
+
<user_total_watching>0</user_total_watching>
|
|
277
|
+
<user_total_completed>0</user_total_completed>
|
|
278
|
+
<user_total_onhold>0</user_total_onhold>
|
|
279
|
+
<user_total_dropped>0</user_total_dropped>
|
|
280
|
+
<user_total_plantowatch>0</user_total_plantowatch>
|
|
281
|
+
</myinfo>
|
|
282
|
+
\n${xmlEntries.join("\n")}\n
|
|
284
283
|
</myanimelist>`;
|
|
285
284
|
});
|
|
286
285
|
}
|
|
@@ -303,19 +302,19 @@ function createMangaListXML(mediaWithProgress) {
|
|
|
303
302
|
const status = statusMap[manga.status];
|
|
304
303
|
return createMangaXML(malId, progress, status, chapters, title);
|
|
305
304
|
});
|
|
306
|
-
return `<myanimelist>
|
|
307
|
-
<myinfo>
|
|
308
|
-
<user_id/>
|
|
309
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
310
|
-
<user_export_type>2</user_export_type>
|
|
311
|
-
<user_total_manga>5</user_total_manga>
|
|
312
|
-
<user_total_reading>1</user_total_reading>
|
|
313
|
-
<user_total_completed>1</user_total_completed>
|
|
314
|
-
<user_total_onhold>1</user_total_onhold>
|
|
315
|
-
<user_total_dropped>1</user_total_dropped>
|
|
316
|
-
<user_total_plantoread>1</user_total_plantoread>
|
|
317
|
-
</myinfo>
|
|
318
|
-
\n${xmlEntries.join("\n")}\n
|
|
305
|
+
return `<myanimelist>
|
|
306
|
+
<myinfo>
|
|
307
|
+
<user_id/>
|
|
308
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
309
|
+
<user_export_type>2</user_export_type>
|
|
310
|
+
<user_total_manga>5</user_total_manga>
|
|
311
|
+
<user_total_reading>1</user_total_reading>
|
|
312
|
+
<user_total_completed>1</user_total_completed>
|
|
313
|
+
<user_total_onhold>1</user_total_onhold>
|
|
314
|
+
<user_total_dropped>1</user_total_dropped>
|
|
315
|
+
<user_total_plantoread>1</user_total_plantoread>
|
|
316
|
+
</myinfo>
|
|
317
|
+
\n${xmlEntries.join("\n")}\n
|
|
319
318
|
</myanimelist>`;
|
|
320
319
|
});
|
|
321
320
|
}
|
|
@@ -381,6 +380,27 @@ const anidbToanilistMapper = (romanjiName, year, englishName) => __awaiter(void
|
|
|
381
380
|
}
|
|
382
381
|
return null;
|
|
383
382
|
});
|
|
383
|
+
function activityBy(activity, count) {
|
|
384
|
+
var _a, _b, _c, _d;
|
|
385
|
+
const countStr = `[${count ? count : "?"}]`.padEnd(6);
|
|
386
|
+
if ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) {
|
|
387
|
+
return `${countStr}${activity.messenger.name} >> messaged ${activity.recipient.name}`;
|
|
388
|
+
}
|
|
389
|
+
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) {
|
|
390
|
+
if (activity.progress) {
|
|
391
|
+
return `${countStr}${activity.user.name} >> ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
return `${countStr}${activity.user.name} >> ${activity.status} ${activity.media.title.userPreferred}`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else if ((_d = activity === null || activity === void 0 ? void 0 : activity.user) === null || _d === void 0 ? void 0 : _d.name) {
|
|
398
|
+
return `${countStr}${activity.user.name}`;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
return `${countStr}???`;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
384
404
|
/**
|
|
385
405
|
* Extract the save file path
|
|
386
406
|
* @param data_type - anime|manga
|
|
@@ -398,4 +418,4 @@ function simpleDateFormat(date) {
|
|
|
398
418
|
}
|
|
399
419
|
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}`;
|
|
400
420
|
}
|
|
401
|
-
export { anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
|
|
421
|
+
export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
|