@irfanshadikrishad/anilist 1.0.0-forbidden.1 → 1.0.0-forbidden.3

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.
@@ -1,4 +1,4 @@
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}";
@@ -9,7 +9,7 @@ declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaLis
9
9
  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
10
  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
11
  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}";
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 } startDate { day month year } episodes status description }\n }\n}";
13
13
  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
14
  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
15
  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}";
@@ -21,5 +21,8 @@ declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $ma
21
21
  declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $malId, type: MANGA) { id title { romaji english } } }\n";
22
22
  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";
23
23
  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";
24
- declare const specificUserActivitiesQuery = "\nquery ($page: Int, $perPage: Int, $userId: Int) {\n Page(page: $page, perPage: $perPage) {\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 { id type isLiked message createdAt recipient { id name } }\n }\n }\n}\n";
25
- 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, };
24
+ 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";
25
+ 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";
26
+ 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";
27
+ declare const toggleFollowMutation = "mutation ($userId: Int!) {\n ToggleFollow(userId: $userId) { id name isFollower isFollowing }\n}\n";
28
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -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
  }`;
@@ -66,7 +66,7 @@ const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
66
66
  }`;
67
67
  const animeSearchQuery = `query ($search: String, $perPage: Int) {
68
68
  Page(perPage: $perPage) {
69
- media(search: $search, type: ANIME) { id title { romaji english native userPreferred } episodes status description }
69
+ media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
70
70
  }
71
71
  }`;
72
72
  const mangaSearchQuery = `query ($search: String, $perPage: Int) {
@@ -150,12 +150,31 @@ query ($page: Int, $perPage: Int) {
150
150
  const specificUserActivitiesQuery = `
151
151
  query ($page: Int, $perPage: Int, $userId: Int) {
152
152
  Page(page: $page, perPage: $perPage) {
153
+ pageInfo { total perPage currentPage lastPage hasNextPage }
153
154
  activities(userId: $userId, sort: ID_DESC) {
154
155
  ... on TextActivity { id type isLiked createdAt user { id name } }
155
156
  ... 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
+ ... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }
157
158
  }
158
159
  }
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, };
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
+ }
168
+ `;
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
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -45,10 +45,7 @@ interface MalIdToAnilistIdResponse {
45
45
  data?: {
46
46
  Media: {
47
47
  id: number;
48
- title: {
49
- english?: string;
50
- romaji?: string;
51
- };
48
+ title: MediaTitle;
52
49
  };
53
50
  };
54
51
  errors?: {
@@ -84,13 +81,7 @@ declare enum MALMangaStatus {
84
81
  interface AnimeList {
85
82
  data?: {
86
83
  MediaListCollection: {
87
- lists: {
88
- name: string;
89
- entries: {
90
- id: number;
91
- progress: number;
92
- }[];
93
- }[];
84
+ lists: MediaList[];
94
85
  };
95
86
  };
96
87
  errors?: {
@@ -98,14 +89,347 @@ interface AnimeList {
98
89
  }[];
99
90
  }
100
91
  interface MediaWithProgress {
101
- malId: number;
92
+ malId?: number;
102
93
  progress: number;
103
94
  status: string;
104
95
  episodes?: number;
105
96
  chapters?: number;
106
- title: {
107
- english?: string;
108
- romaji?: string;
97
+ format?: string;
98
+ title: MediaTitle;
99
+ }
100
+ interface MediaTitle {
101
+ english?: string;
102
+ romaji?: string;
103
+ native?: string;
104
+ userPreferred?: string;
105
+ }
106
+ interface Media {
107
+ id: number;
108
+ idMal?: number;
109
+ title: MediaTitle;
110
+ chapters?: number;
111
+ }
112
+ interface MediaEntry {
113
+ media: Media;
114
+ private: boolean;
115
+ progress: number;
116
+ status: string;
117
+ hiddenFromStatusLists: boolean;
118
+ }
119
+ interface SaveTextActivityResponse {
120
+ data?: {
121
+ SaveTextActivity: {
122
+ id: number;
123
+ userId: number;
124
+ text: string;
125
+ createdAt: number;
126
+ };
127
+ };
128
+ errors?: {
129
+ message: string;
130
+ }[];
131
+ }
132
+ interface MediaListCollectionResponse {
133
+ data?: {
134
+ MediaListCollection: {
135
+ lists: MediaList[];
136
+ };
137
+ };
138
+ errors?: {
139
+ message: string;
140
+ }[];
141
+ }
142
+ interface List {
143
+ name: string;
144
+ entries: MediaEntry[];
145
+ }
146
+ interface MediaList {
147
+ id(id: number | string): string;
148
+ title: MediaTitle;
149
+ name: string;
150
+ entries: MediaListEntry[];
151
+ }
152
+ interface Myself {
153
+ data?: {
154
+ Viewer: {
155
+ id: number;
156
+ name: string;
157
+ siteUrl: string;
158
+ options: {
159
+ profileColor: string;
160
+ timezone: string;
161
+ activityMergeTime: string;
162
+ };
163
+ donatorTier: string;
164
+ donatorBadge: string;
165
+ unreadNotificationCount: number;
166
+ createdAt: number;
167
+ updatedAt: number;
168
+ statistics: {
169
+ anime: {
170
+ count: number;
171
+ meanScore: string;
172
+ minutesWatched: string;
173
+ episodesWatched: number;
174
+ };
175
+ manga: {
176
+ count: number;
177
+ meanScore: string;
178
+ chaptersRead: number;
179
+ volumesRead: number;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ errors?: {
185
+ message: string;
186
+ }[];
187
+ }
188
+ interface DateMonthYear {
189
+ day?: number;
190
+ month?: number;
191
+ year?: number;
192
+ }
193
+ interface AnimeDetails {
194
+ data?: {
195
+ Media: {
196
+ id: number;
197
+ title: MediaTitle;
198
+ description: string;
199
+ duration: string;
200
+ startDate: DateMonthYear;
201
+ endDate: DateMonthYear;
202
+ countryOfOrigin: string;
203
+ isAdult: boolean;
204
+ status: string;
205
+ season: string;
206
+ format: string;
207
+ genres: [string];
208
+ siteUrl: string;
209
+ };
210
+ };
211
+ errors?: {
212
+ message: string;
213
+ }[];
214
+ }
215
+ interface SaveMediaListEntryResponse {
216
+ data?: {
217
+ SaveMediaListEntry: {
218
+ id: number;
219
+ status: string;
220
+ };
221
+ };
222
+ errors?: {
223
+ message: string;
224
+ }[];
225
+ }
226
+ interface MediaListEntry {
227
+ id?: number;
228
+ media: {
229
+ id?: number;
230
+ idMal?: number;
231
+ title?: MediaTitle;
232
+ episodes?: number;
233
+ siteUrl?: string;
234
+ chapters?: number;
235
+ format?: string;
236
+ };
237
+ progress?: number;
238
+ status?: string;
239
+ hiddenFromStatusLists?: boolean;
240
+ private?: boolean;
241
+ }
242
+ type UserActivitiesResponse = {
243
+ data?: {
244
+ Page: {
245
+ activities: Activity[];
246
+ };
247
+ };
248
+ errors?: {
249
+ message: string;
250
+ }[];
251
+ };
252
+ type UserResponse = {
253
+ data?: {
254
+ User: {
255
+ id: number;
256
+ name: string;
257
+ siteUrl: string;
258
+ donatorTier: string;
259
+ donatorBadge: string;
260
+ createdAt: number;
261
+ updatedAt: number;
262
+ isBlocked: boolean;
263
+ isFollower: boolean;
264
+ isFollowing: boolean;
265
+ options: {
266
+ profileColor: string;
267
+ timezone: string;
268
+ };
269
+ statistics: {
270
+ anime: {
271
+ count: number;
272
+ episodesWatched: number;
273
+ minutesWatched: number;
274
+ };
275
+ manga: {
276
+ count: number;
277
+ chaptersRead: number;
278
+ volumesRead: number;
279
+ };
280
+ };
281
+ };
282
+ };
283
+ errors?: {
284
+ message: string;
285
+ }[];
286
+ };
287
+ type User = {
288
+ id: number;
289
+ name: string;
290
+ avatar: {
291
+ large: string;
292
+ medium: string;
293
+ };
294
+ bannerImage: string;
295
+ isFollower: boolean;
296
+ isFollowing: boolean;
297
+ };
298
+ type UserFollower = {
299
+ data?: {
300
+ Page: {
301
+ pageInfo: {
302
+ total: number;
303
+ perPage: number;
304
+ currentPage: number;
305
+ lastPage: number;
306
+ hasNextPage: boolean;
307
+ };
308
+ followers: User[];
309
+ };
310
+ };
311
+ errors?: {
312
+ message: string;
313
+ }[];
314
+ };
315
+ type UserFollowing = {
316
+ data?: {
317
+ Page: {
318
+ pageInfo: {
319
+ total: number;
320
+ perPage: number;
321
+ currentPage: number;
322
+ lastPage: number;
323
+ hasNextPage: boolean;
324
+ };
325
+ following: User[];
326
+ };
327
+ };
328
+ errors?: {
329
+ message: string;
330
+ }[];
331
+ };
332
+ type AnimeSearchResponse = {
333
+ data?: {
334
+ Page: {
335
+ media: {
336
+ id: number;
337
+ title: MediaTitle;
338
+ startDate: DateMonthYear;
339
+ episodes: number;
340
+ status: string;
341
+ description: string;
342
+ }[];
343
+ };
344
+ };
345
+ errors?: {
346
+ message: string;
347
+ }[];
348
+ };
349
+ type ToggleFollowResponse = {
350
+ data?: {
351
+ ToggleFollow: {
352
+ id: number;
353
+ name: string;
354
+ isFollower: boolean;
355
+ isFollowing: boolean;
356
+ };
357
+ };
358
+ errors?: {
359
+ message: string;
360
+ }[];
361
+ };
362
+ type DeleteMediaListResponse = {
363
+ data?: {
364
+ DeleteMediaListEntry: {
365
+ deleted: boolean;
366
+ };
367
+ };
368
+ errors?: {
369
+ message: string;
370
+ }[];
371
+ };
372
+ type Activity = {
373
+ id: number;
374
+ type: string;
375
+ status: string;
376
+ progress: number | null;
377
+ media: {
378
+ id?: number;
379
+ title: MediaTitle;
380
+ };
381
+ createdAt: number;
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;
109
399
  };
400
+ media?: {
401
+ title?: {
402
+ userPreferred: string;
403
+ };
404
+ };
405
+ progress?: string | null;
406
+ status?: string;
110
407
  }
111
- export { AniListMediaStatus, AnimeList, DeleteMangaResponse, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaWithProgress, saveAnimeWithProgressResponse, };
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
+ };
435
+ export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, 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 };
@@ -0,0 +1,117 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { parseStringPromise } from "xml2js";
11
+ class Validate {
12
+ /**
13
+ * Validate importable JSON file
14
+ * @param data string
15
+ * @returns boolean
16
+ */
17
+ static Import_JSON(data) {
18
+ return (Array.isArray(data) &&
19
+ data.every((item) => typeof item === "object" && item !== null && "id" in item));
20
+ }
21
+ /**
22
+ * Validate if MyAnimeList Anime XML file is valid or not
23
+ * @param xmlData string
24
+ * @returns boolean
25
+ */
26
+ static Import_AnimeXML(xmlData) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ const result = yield parseStringPromise(xmlData, { explicitArray: false });
30
+ if (!result || !result.myanimelist) {
31
+ console.error("Invalid XML structure: Missing 'myanimelist' root element.");
32
+ return false;
33
+ }
34
+ const animeList = result.myanimelist.anime;
35
+ if (!animeList) {
36
+ console.error("Invalid XML structure: Missing 'anime' elements.");
37
+ return false;
38
+ }
39
+ const animeArray = Array.isArray(animeList) ? animeList : [animeList];
40
+ const isValid = animeArray.every((anime) => {
41
+ const isValidId = anime.series_animedb_id && !isNaN(Number(anime.series_animedb_id));
42
+ const hasRequiredFields = anime.series_title && anime.my_status;
43
+ return isValidId && hasRequiredFields;
44
+ });
45
+ if (!isValid) {
46
+ console.error("Validation failed: Some anime entries are missing required fields or have invalid IDs.");
47
+ }
48
+ return isValid;
49
+ }
50
+ catch (error) {
51
+ console.error("Error parsing or validating XML:", error);
52
+ return false;
53
+ }
54
+ });
55
+ }
56
+ /**
57
+ * Validate if MyAnimeList Anime XML file is valid or not
58
+ * @param xmlData string
59
+ * @returns boolean
60
+ */
61
+ static Import_MangaXML(xmlData) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ try {
64
+ const result = yield parseStringPromise(xmlData, { explicitArray: false });
65
+ if (!result || !result.myanimelist) {
66
+ console.error("Invalid XML structure: Missing 'myanimelist' root element.");
67
+ return false;
68
+ }
69
+ const mangaList = result.myanimelist.manga;
70
+ if (!mangaList) {
71
+ console.error("Invalid XML structure: Missing 'manga' elements.");
72
+ return false;
73
+ }
74
+ const mangaArray = Array.isArray(mangaList) ? mangaList : [mangaList];
75
+ const isValid = mangaArray.every((manga) => {
76
+ const isValidId = manga.manga_mangadb_id && !isNaN(Number(manga.manga_mangadb_id));
77
+ const hasRequiredFields = manga.manga_title && manga.my_status;
78
+ return isValidId && hasRequiredFields;
79
+ });
80
+ if (!isValid) {
81
+ console.error("Validation failed: Some manga entries are missing required fields or have invalid IDs.");
82
+ }
83
+ return isValid;
84
+ }
85
+ catch (error) {
86
+ console.error("Error parsing or validating XML:", error);
87
+ return false;
88
+ }
89
+ });
90
+ }
91
+ /**
92
+ * Validate AniDB json-large file
93
+ * @param file string of anidb json-large
94
+ * @returns boolean
95
+ */
96
+ static Import_AniDBJSONLarge(file) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ try {
99
+ if (!(file === null || file === void 0 ? void 0 : file.trim())) {
100
+ console.error("File content is empty or invalid.");
101
+ return false;
102
+ }
103
+ const obj3ct = JSON.parse(file);
104
+ if (!obj3ct || !Array.isArray(obj3ct.anime)) {
105
+ console.error("Invalid JSON structure: Missing or malformed 'anime' array.");
106
+ return false;
107
+ }
108
+ return true;
109
+ }
110
+ catch (error) {
111
+ console.error("Failed to parse JSON file:", error);
112
+ return false;
113
+ }
114
+ });
115
+ }
116
+ }
117
+ export { Validate };
@@ -1,4 +1,4 @@
1
- import { MALAnimeStatus, MALMangaStatus, MediaWithProgress } from "./types.js";
1
+ import { MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
2
2
  declare const aniListEndpoint = "https://graphql.anilist.co";
3
3
  declare const redirectUri = "https://anilist.co/api/v2/oauth/pin";
4
4
  declare function getTitle(title: {
@@ -6,9 +6,9 @@ declare function getTitle(title: {
6
6
  romaji?: string;
7
7
  }): string;
8
8
  declare function formatDateObject(dateObj: {
9
- day?: string;
10
- month?: string;
11
- year?: string;
9
+ day?: number;
10
+ month?: number;
11
+ year?: number;
12
12
  } | null): string;
13
13
  declare function getNextSeasonAndYear(): {
14
14
  nextSeason: string;
@@ -20,18 +20,30 @@ declare function getFormattedDate(): string;
20
20
  /**
21
21
  * Export JSON as JSON
22
22
  * @param js0n
23
- * @param dataType (eg: anime/manga)
23
+ * @param dataType (eg: anime|manga)
24
24
  */
25
25
  declare function saveJSONasJSON(js0n: object, dataType: string): Promise<void>;
26
26
  /**
27
27
  * Export JSON as CSV
28
28
  * @param js0n
29
- * @param dataType (eg: anime/manga)
29
+ * @param dataType (eg: anime|manga)
30
30
  */
31
- declare function saveJSONasCSV(js0n: object, dataType: string): Promise<void>;
31
+ declare function saveJSONasCSV(js0n: MediaWithProgress[], dataType: string): Promise<void>;
32
+ declare function saveJSONasXML(js0n: MediaWithProgress[], data_type: 0 | 1): Promise<void>;
32
33
  declare function selectFile(fileType: string): Promise<string>;
33
- declare function createAnimeXML(malId: number, progress: number, status: MALAnimeStatus, episodes: number, title: string): string;
34
+ declare function createAnimeXML(malId: number, progress: number, status: MALAnimeStatus, episodes: number, title: string, format: string): string;
34
35
  declare function createMangaXML(malId: number, progress: number, status: MALMangaStatus, chapters: number, title: string): string;
35
36
  declare function createAnimeListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
36
37
  declare function createMangaListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
37
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
38
+ declare function getCurrentPackageVersion(): string | null;
39
+ declare function timestampToTimeAgo(timestamp: number): string;
40
+ declare const anidbToanilistMapper: (romanjiName: string, year: number, englishName?: string) => Promise<number | null>;
41
+ declare function activityBy(activity: TheActivity, count?: number): string;
42
+ /**
43
+ * Extract the save file path
44
+ * @param data_type - anime|manga
45
+ * @param file_format - save format (eg: .json|.csv)
46
+ * @returns string of file path
47
+ */
48
+ declare function saveToPath(data_type: string, file_format: string): Promise<string>;
49
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, timestampToTimeAgo, };