@irfanshadikrishad/anilist 1.2.0-forbidden.1 → 1.2.1-forbidden.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +382 -382
- package/README.md +245 -245
- package/bin/helpers/auth.d.ts +35 -6
- package/bin/helpers/auth.js +38 -60
- package/bin/helpers/fetcher.d.ts +1 -1
- package/bin/helpers/lists.d.ts +1 -1
- package/bin/helpers/lists.js +72 -134
- package/bin/helpers/mutations.js +35 -35
- package/bin/helpers/queries.d.ts +1 -1
- package/bin/helpers/queries.js +153 -153
- package/bin/helpers/types.d.ts +112 -8
- package/bin/helpers/workers.d.ts +2 -1
- package/bin/helpers/workers.js +94 -67
- package/bin/index.js +2 -2
- package/package.json +4 -4
package/bin/helpers/queries.js
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
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 } manga { count chaptersRead volumesRead } }
|
|
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 } status episodes siteUrl } } }
|
|
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 } status episodes siteUrl } } }
|
|
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 } 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 } 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 } 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 } } }
|
|
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 } 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 } } }
|
|
124
124
|
`;
|
|
125
|
-
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
126
|
-
Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
|
|
125
|
+
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
126
|
+
Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
|
|
127
127
|
`;
|
|
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
|
-
}
|
|
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 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
|
-
}
|
|
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
|
+
}
|
|
149
149
|
`;
|
|
150
|
-
const specificUserActivitiesQuery = `
|
|
151
|
-
query ($page: Int, $perPage: Int, $userId: Int) {
|
|
152
|
-
Page(page: $page, perPage: $perPage) {
|
|
153
|
-
activities(userId: $userId, sort: ID_DESC) {
|
|
154
|
-
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
155
|
-
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
156
|
-
... on MessageActivity { id type isLiked message createdAt recipient { id name } }
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
150
|
+
const specificUserActivitiesQuery = `
|
|
151
|
+
query ($page: Int, $perPage: Int, $userId: Int) {
|
|
152
|
+
Page(page: $page, perPage: $perPage) {
|
|
153
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
154
|
+
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
155
|
+
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
156
|
+
... on MessageActivity { id type isLiked message createdAt recipient { id name } }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
160
|
`;
|
|
161
161
|
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };
|
package/bin/helpers/types.d.ts
CHANGED
|
@@ -84,13 +84,7 @@ declare enum MALMangaStatus {
|
|
|
84
84
|
interface AnimeList {
|
|
85
85
|
data?: {
|
|
86
86
|
MediaListCollection: {
|
|
87
|
-
lists:
|
|
88
|
-
name: string;
|
|
89
|
-
entries: {
|
|
90
|
-
id: number;
|
|
91
|
-
progress: number;
|
|
92
|
-
}[];
|
|
93
|
-
}[];
|
|
87
|
+
lists: MediaList[];
|
|
94
88
|
};
|
|
95
89
|
};
|
|
96
90
|
errors?: {
|
|
@@ -108,4 +102,114 @@ interface MediaWithProgress {
|
|
|
108
102
|
romaji?: string;
|
|
109
103
|
};
|
|
110
104
|
}
|
|
111
|
-
|
|
105
|
+
interface MediaTitle {
|
|
106
|
+
english?: string;
|
|
107
|
+
romaji?: string;
|
|
108
|
+
native?: string;
|
|
109
|
+
userPreferred?: string;
|
|
110
|
+
}
|
|
111
|
+
interface Media {
|
|
112
|
+
id: number;
|
|
113
|
+
idMal?: number;
|
|
114
|
+
title: MediaTitle;
|
|
115
|
+
chapters?: number;
|
|
116
|
+
}
|
|
117
|
+
interface MediaEntry {
|
|
118
|
+
media: Media;
|
|
119
|
+
private: boolean;
|
|
120
|
+
progress: number;
|
|
121
|
+
status: string;
|
|
122
|
+
hiddenFromStatusLists: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface List {
|
|
125
|
+
name: string;
|
|
126
|
+
entries: MediaEntry[];
|
|
127
|
+
}
|
|
128
|
+
interface MediaList {
|
|
129
|
+
id(id: number | string): string;
|
|
130
|
+
title: {
|
|
131
|
+
english?: string;
|
|
132
|
+
romaji?: string;
|
|
133
|
+
};
|
|
134
|
+
name: string;
|
|
135
|
+
entries: MediaListEntry[];
|
|
136
|
+
}
|
|
137
|
+
interface Myself {
|
|
138
|
+
data?: {
|
|
139
|
+
Viewer: {
|
|
140
|
+
id: number;
|
|
141
|
+
name: string;
|
|
142
|
+
siteUrl: string;
|
|
143
|
+
options: {
|
|
144
|
+
profileColor: string;
|
|
145
|
+
timezone: string;
|
|
146
|
+
activityMergeTime: string;
|
|
147
|
+
};
|
|
148
|
+
donatorTier: string;
|
|
149
|
+
donatorBadge: string;
|
|
150
|
+
unreadNotificationCount: number;
|
|
151
|
+
createdAt: number;
|
|
152
|
+
updatedAt: number;
|
|
153
|
+
statistics: {
|
|
154
|
+
anime: {
|
|
155
|
+
count: number;
|
|
156
|
+
meanScore: string;
|
|
157
|
+
minutesWatched: string;
|
|
158
|
+
episodesWatched: number;
|
|
159
|
+
};
|
|
160
|
+
manga: {
|
|
161
|
+
count: number;
|
|
162
|
+
meanScore: string;
|
|
163
|
+
chaptersRead: number;
|
|
164
|
+
volumesRead: number;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
errors?: {
|
|
170
|
+
message: string;
|
|
171
|
+
}[];
|
|
172
|
+
}
|
|
173
|
+
interface DateMonthYear {
|
|
174
|
+
day?: string;
|
|
175
|
+
month?: string;
|
|
176
|
+
year?: string;
|
|
177
|
+
}
|
|
178
|
+
interface AnimeDetails {
|
|
179
|
+
data?: {
|
|
180
|
+
Media: {
|
|
181
|
+
id: number;
|
|
182
|
+
title: MediaTitle;
|
|
183
|
+
description: string;
|
|
184
|
+
duration: string;
|
|
185
|
+
startDate: DateMonthYear;
|
|
186
|
+
endDate: DateMonthYear;
|
|
187
|
+
countryOfOrigin: string;
|
|
188
|
+
isAdult: boolean;
|
|
189
|
+
status: string;
|
|
190
|
+
season: string;
|
|
191
|
+
format: string;
|
|
192
|
+
genres: [string];
|
|
193
|
+
siteUrl: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
errors?: {
|
|
197
|
+
message: string;
|
|
198
|
+
}[];
|
|
199
|
+
}
|
|
200
|
+
interface MediaListEntry {
|
|
201
|
+
id?: number;
|
|
202
|
+
media: {
|
|
203
|
+
id?: number;
|
|
204
|
+
idMal?: number;
|
|
205
|
+
title?: MediaTitle;
|
|
206
|
+
episodes?: number;
|
|
207
|
+
siteUrl?: string;
|
|
208
|
+
chapters?: number;
|
|
209
|
+
};
|
|
210
|
+
progress?: number;
|
|
211
|
+
status?: string;
|
|
212
|
+
hiddenFromStatusLists?: boolean;
|
|
213
|
+
private?: boolean;
|
|
214
|
+
}
|
|
215
|
+
export { AniListMediaStatus, AnimeDetails, AnimeList, DateMonthYear, DeleteMangaResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListEntry, MediaTitle, MediaWithProgress, Myself, saveAnimeWithProgressResponse, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -35,4 +35,5 @@ 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
|
-
|
|
38
|
+
declare function timestampToTimeAgo(timestamp: number): string;
|
|
39
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
|
package/bin/helpers/workers.js
CHANGED
|
@@ -170,49 +170,49 @@ function selectFile(fileType) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
function createAnimeXML(malId, progress, status, episodes, title) {
|
|
173
|
-
return `
|
|
174
|
-
<anime>
|
|
175
|
-
<series_animedb_id>${malId}</series_animedb_id>
|
|
176
|
-
<series_title><![CDATA[${title}]]></series_title>
|
|
177
|
-
<series_type>""</series_type>
|
|
178
|
-
<series_episodes>${episodes}</series_episodes>
|
|
179
|
-
<my_id>0</my_id>
|
|
180
|
-
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
181
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
182
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
183
|
-
<my_score>0</my_score>
|
|
184
|
-
<my_storage_value>0.00</my_storage_value>
|
|
185
|
-
<my_status>${status}</my_status>
|
|
186
|
-
<my_comments><![CDATA[]]></my_comments>
|
|
187
|
-
<my_times_watched>0</my_times_watched>
|
|
188
|
-
<my_rewatch_value></my_rewatch_value>
|
|
189
|
-
<my_priority>LOW</my_priority>
|
|
190
|
-
<my_tags><![CDATA[]]></my_tags>
|
|
191
|
-
<my_rewatching>0</my_rewatching>
|
|
192
|
-
<my_rewatching_ep>0</my_rewatching_ep>
|
|
193
|
-
<my_discuss>0</my_discuss>
|
|
194
|
-
<my_sns>default</my_sns>
|
|
195
|
-
<update_on_import>1</update_on_import>
|
|
173
|
+
return `
|
|
174
|
+
<anime>
|
|
175
|
+
<series_animedb_id>${malId}</series_animedb_id>
|
|
176
|
+
<series_title><![CDATA[${title}]]></series_title>
|
|
177
|
+
<series_type>""</series_type>
|
|
178
|
+
<series_episodes>${episodes}</series_episodes>
|
|
179
|
+
<my_id>0</my_id>
|
|
180
|
+
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
181
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
182
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
183
|
+
<my_score>0</my_score>
|
|
184
|
+
<my_storage_value>0.00</my_storage_value>
|
|
185
|
+
<my_status>${status}</my_status>
|
|
186
|
+
<my_comments><![CDATA[]]></my_comments>
|
|
187
|
+
<my_times_watched>0</my_times_watched>
|
|
188
|
+
<my_rewatch_value></my_rewatch_value>
|
|
189
|
+
<my_priority>LOW</my_priority>
|
|
190
|
+
<my_tags><![CDATA[]]></my_tags>
|
|
191
|
+
<my_rewatching>0</my_rewatching>
|
|
192
|
+
<my_rewatching_ep>0</my_rewatching_ep>
|
|
193
|
+
<my_discuss>0</my_discuss>
|
|
194
|
+
<my_sns>default</my_sns>
|
|
195
|
+
<update_on_import>1</update_on_import>
|
|
196
196
|
</anime>`;
|
|
197
197
|
}
|
|
198
198
|
function createMangaXML(malId, progress, status, chapters, title) {
|
|
199
|
-
return `
|
|
200
|
-
<manga>
|
|
201
|
-
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
202
|
-
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
203
|
-
<manga_volumes>0</manga_volumes>
|
|
204
|
-
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
205
|
-
<my_id>0</my_id>
|
|
206
|
-
<my_read_chapters>${progress}</my_read_chapters>
|
|
207
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
208
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
209
|
-
<my_score>0</my_score>
|
|
210
|
-
<my_status>${status}</my_status>
|
|
211
|
-
<my_reread_value></my_reread_value>
|
|
212
|
-
<my_priority>LOW</my_priority>
|
|
213
|
-
<my_rereading>0</my_rereading>
|
|
214
|
-
<my_discuss>0</my_discuss>
|
|
215
|
-
<update_on_import>1</update_on_import>
|
|
199
|
+
return `
|
|
200
|
+
<manga>
|
|
201
|
+
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
202
|
+
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
203
|
+
<manga_volumes>0</manga_volumes>
|
|
204
|
+
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
205
|
+
<my_id>0</my_id>
|
|
206
|
+
<my_read_chapters>${progress}</my_read_chapters>
|
|
207
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
208
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
209
|
+
<my_score>0</my_score>
|
|
210
|
+
<my_status>${status}</my_status>
|
|
211
|
+
<my_reread_value></my_reread_value>
|
|
212
|
+
<my_priority>LOW</my_priority>
|
|
213
|
+
<my_rereading>0</my_rereading>
|
|
214
|
+
<my_discuss>0</my_discuss>
|
|
215
|
+
<update_on_import>1</update_on_import>
|
|
216
216
|
</manga>`;
|
|
217
217
|
}
|
|
218
218
|
function createAnimeListXML(mediaWithProgress) {
|
|
@@ -232,19 +232,19 @@ function createAnimeListXML(mediaWithProgress) {
|
|
|
232
232
|
const status = statusMap[anime.status];
|
|
233
233
|
return createAnimeXML(malId, progress, status, episodes, title);
|
|
234
234
|
});
|
|
235
|
-
return `<myanimelist>
|
|
236
|
-
<myinfo>
|
|
237
|
-
<user_id/>
|
|
238
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
239
|
-
<user_export_type>1</user_export_type>
|
|
240
|
-
<user_total_anime>0</user_total_anime>
|
|
241
|
-
<user_total_watching>0</user_total_watching>
|
|
242
|
-
<user_total_completed>0</user_total_completed>
|
|
243
|
-
<user_total_onhold>0</user_total_onhold>
|
|
244
|
-
<user_total_dropped>0</user_total_dropped>
|
|
245
|
-
<user_total_plantowatch>0</user_total_plantowatch>
|
|
246
|
-
</myinfo>
|
|
247
|
-
\n${xmlEntries.join("\n")}\n
|
|
235
|
+
return `<myanimelist>
|
|
236
|
+
<myinfo>
|
|
237
|
+
<user_id/>
|
|
238
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
239
|
+
<user_export_type>1</user_export_type>
|
|
240
|
+
<user_total_anime>0</user_total_anime>
|
|
241
|
+
<user_total_watching>0</user_total_watching>
|
|
242
|
+
<user_total_completed>0</user_total_completed>
|
|
243
|
+
<user_total_onhold>0</user_total_onhold>
|
|
244
|
+
<user_total_dropped>0</user_total_dropped>
|
|
245
|
+
<user_total_plantowatch>0</user_total_plantowatch>
|
|
246
|
+
</myinfo>
|
|
247
|
+
\n${xmlEntries.join("\n")}\n
|
|
248
248
|
</myanimelist>`;
|
|
249
249
|
});
|
|
250
250
|
}
|
|
@@ -265,19 +265,19 @@ function createMangaListXML(mediaWithProgress) {
|
|
|
265
265
|
const status = statusMap[manga.status];
|
|
266
266
|
return createMangaXML(malId, progress, status, chapters, title);
|
|
267
267
|
});
|
|
268
|
-
return `<myanimelist>
|
|
269
|
-
<myinfo>
|
|
270
|
-
<user_id/>
|
|
271
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
272
|
-
<user_export_type>2</user_export_type>
|
|
273
|
-
<user_total_manga>5</user_total_manga>
|
|
274
|
-
<user_total_reading>1</user_total_reading>
|
|
275
|
-
<user_total_completed>1</user_total_completed>
|
|
276
|
-
<user_total_onhold>1</user_total_onhold>
|
|
277
|
-
<user_total_dropped>1</user_total_dropped>
|
|
278
|
-
<user_total_plantoread>1</user_total_plantoread>
|
|
279
|
-
</myinfo>
|
|
280
|
-
\n${xmlEntries.join("\n")}\n
|
|
268
|
+
return `<myanimelist>
|
|
269
|
+
<myinfo>
|
|
270
|
+
<user_id/>
|
|
271
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
272
|
+
<user_export_type>2</user_export_type>
|
|
273
|
+
<user_total_manga>5</user_total_manga>
|
|
274
|
+
<user_total_reading>1</user_total_reading>
|
|
275
|
+
<user_total_completed>1</user_total_completed>
|
|
276
|
+
<user_total_onhold>1</user_total_onhold>
|
|
277
|
+
<user_total_dropped>1</user_total_dropped>
|
|
278
|
+
<user_total_plantoread>1</user_total_plantoread>
|
|
279
|
+
</myinfo>
|
|
280
|
+
\n${xmlEntries.join("\n")}\n
|
|
281
281
|
</myanimelist>`;
|
|
282
282
|
});
|
|
283
283
|
}
|
|
@@ -287,4 +287,31 @@ function getCurrentPackageVersion() {
|
|
|
287
287
|
const version = packageJson.version;
|
|
288
288
|
return version || null;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
function timestampToTimeAgo(timestamp) {
|
|
291
|
+
const now = Math.floor(Date.now() / 1000);
|
|
292
|
+
const elapsed = now - timestamp;
|
|
293
|
+
if (elapsed < 60) {
|
|
294
|
+
return `${elapsed} second${elapsed === 1 ? "" : "s"} ago`;
|
|
295
|
+
}
|
|
296
|
+
else if (elapsed < 3600) {
|
|
297
|
+
const minutes = Math.floor(elapsed / 60);
|
|
298
|
+
return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
|
|
299
|
+
}
|
|
300
|
+
else if (elapsed < 86400) {
|
|
301
|
+
const hours = Math.floor(elapsed / 3600);
|
|
302
|
+
return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
303
|
+
}
|
|
304
|
+
else if (elapsed < 2592000) {
|
|
305
|
+
const days = Math.floor(elapsed / 86400);
|
|
306
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
307
|
+
}
|
|
308
|
+
else if (elapsed < 31536000) {
|
|
309
|
+
const months = Math.floor(elapsed / 2592000);
|
|
310
|
+
return `${months} month${months === 1 ? "" : "s"} ago`;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const years = Math.floor(elapsed / 31536000);
|
|
314
|
+
return `${years} year${years === 1 ? "" : "s"} ago`;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
|
package/bin/index.js
CHANGED
|
@@ -32,7 +32,7 @@ cli
|
|
|
32
32
|
}
|
|
33
33
|
}));
|
|
34
34
|
cli
|
|
35
|
-
.command("
|
|
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("-
|
|
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) {
|