@irfanshadikrishad/anilist 1.0.3 → 1.0.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/CHANGELOG.md +10 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +75 -0
- package/README.md +56 -17
- package/bin/helpers/auth.js +6 -5
- package/bin/helpers/fetcher.js +2 -2
- package/bin/helpers/lists.js +36 -36
- package/bin/helpers/more.d.ts +6 -1
- package/bin/helpers/more.js +208 -18
- package/bin/helpers/mutations.d.ts +4 -1
- package/bin/helpers/mutations.js +19 -1
- package/bin/helpers/queries.d.ts +10 -10
- package/bin/helpers/queries.js +13 -26
- package/bin/helpers/workers.d.ts +15 -1
- package/bin/helpers/workers.js +178 -1
- package/bin/index.js +64 -10
- package/package.json +24 -4
package/bin/helpers/more.js
CHANGED
|
@@ -8,12 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import fetch from "node-fetch";
|
|
11
|
-
import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, mangaSearchQuery, userActivityQuery, userQuery, } from "./queries.js";
|
|
11
|
+
import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, mangaSearchQuery, userActivityQuery, userQuery, } from "./queries.js";
|
|
12
12
|
import { currentUsersId, isLoggedIn, retriveAccessToken } from "./auth.js";
|
|
13
|
-
import { aniListEndpoint, formatDateObject, getTitle, removeHtmlAndMarkdown, } from "./workers.js";
|
|
13
|
+
import { aniListEndpoint, formatDateObject, getTitle, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, } from "./workers.js";
|
|
14
14
|
import { fetcher } from "./fetcher.js";
|
|
15
15
|
import inquirer from "inquirer";
|
|
16
|
-
import { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, } from "./mutations.js";
|
|
16
|
+
import { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, } from "./mutations.js";
|
|
17
17
|
function getUserInfoByUsername(username) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
@@ -65,11 +65,11 @@ function getUserInfoByUsername(username) {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
console.
|
|
68
|
+
console.error(`\n${request.status} ${(_t = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _t === void 0 ? void 0 : _t.message}`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
|
-
console.
|
|
72
|
+
console.error(`\nSomething went wrong. ${error.message}`);
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -145,7 +145,7 @@ function getAnimeSearchResults(search, count) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
console.error(
|
|
148
|
+
console.error(`\nPlease log in first to use this feature.`);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
else {
|
|
@@ -153,7 +153,7 @@ function getAnimeSearchResults(search, count) {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
console.error(
|
|
156
|
+
console.error(`\nSomething went wrong.`);
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
}
|
|
@@ -205,11 +205,11 @@ function getMangaSearchResults(search, count) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
console.error(
|
|
208
|
+
console.error(`\nPlease log in first to use this feature.`);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
else {
|
|
212
|
-
console.error(
|
|
212
|
+
console.error(`\nSomething went wrong.`);
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
}
|
|
@@ -264,21 +264,211 @@ function deleteUserActivities() {
|
|
|
264
264
|
}
|
|
265
265
|
else {
|
|
266
266
|
for (let act of activities) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
// Making sure to have ID
|
|
268
|
+
// to avoid unintended errors
|
|
269
|
+
if (act === null || act === void 0 ? void 0 : act.id) {
|
|
270
|
+
const activityID = act === null || act === void 0 ? void 0 : act.id;
|
|
271
|
+
const deleteResponse = yield fetcher(deleteActivityMutation, {
|
|
272
|
+
id: activityID,
|
|
273
|
+
});
|
|
274
|
+
const isDeleted = (_d = (_c = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _c === void 0 ? void 0 : _c.DeleteActivity) === null || _d === void 0 ? void 0 : _d.deleted;
|
|
275
|
+
console.log(`${activityID} ${isDeleted ? "✅" : "❌"}`);
|
|
276
|
+
// avoiding rate-limit
|
|
277
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
console.error(`\nPlease log in to delete your activities.`);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function writeTextActivity(status) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
var _a;
|
|
291
|
+
try {
|
|
292
|
+
if (yield isLoggedIn()) {
|
|
293
|
+
const query = saveTextActivityMutation;
|
|
294
|
+
const addTagInStatus = status +
|
|
295
|
+
`<br><br><br><br>*Written using [@irfanshadikrishad/anilist](https://www.npmjs.com/package/@irfanshadikrishad/anilist).*`;
|
|
296
|
+
const variables = { status: addTagInStatus };
|
|
297
|
+
const data = yield fetcher(query, variables);
|
|
298
|
+
if (data) {
|
|
299
|
+
const savedActivity = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.SaveTextActivity;
|
|
300
|
+
if (savedActivity === null || savedActivity === void 0 ? void 0 : savedActivity.id) {
|
|
301
|
+
console.log(`\n[${savedActivity === null || savedActivity === void 0 ? void 0 : savedActivity.id}] status saved successfully!`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
console.error(`\nSomething went wrong. ${data}.`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
console.error(`\nPlease login to use this feature.`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
console.error(`\n${error.message}`);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
function exportAnimeList() {
|
|
318
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
319
|
+
var _a, _b, _c;
|
|
320
|
+
if (yield isLoggedIn()) {
|
|
321
|
+
const { exportType } = yield inquirer.prompt([
|
|
322
|
+
{
|
|
323
|
+
type: "list",
|
|
324
|
+
name: "exportType",
|
|
325
|
+
message: "Choose export type:",
|
|
326
|
+
choices: [
|
|
327
|
+
{ name: "CSV", value: 1 },
|
|
328
|
+
{ name: "JSON", value: 2 },
|
|
329
|
+
],
|
|
330
|
+
pageSize: 10,
|
|
331
|
+
},
|
|
332
|
+
]);
|
|
333
|
+
const animeList = yield fetcher(currentUserAnimeList, {
|
|
334
|
+
id: yield currentUsersId(),
|
|
335
|
+
});
|
|
336
|
+
if (animeList) {
|
|
337
|
+
const lists = (_c = (_b = (_a = animeList === null || animeList === void 0 ? void 0 : animeList.data) === null || _a === void 0 ? void 0 : _a.MediaListCollection) === null || _b === void 0 ? void 0 : _b.lists) !== null && _c !== void 0 ? _c : [];
|
|
338
|
+
const mediaWithProgress = lists.flatMap((list) => list.entries.map((entry) => {
|
|
339
|
+
var _a, _b, _c, _d, _e;
|
|
340
|
+
return ({
|
|
341
|
+
id: (_a = entry === null || entry === void 0 ? void 0 : entry.media) === null || _a === void 0 ? void 0 : _a.id,
|
|
342
|
+
title: exportType === 1
|
|
343
|
+
? getTitle((_b = entry === null || entry === void 0 ? void 0 : entry.media) === null || _b === void 0 ? void 0 : _b.title)
|
|
344
|
+
: (_c = entry === null || entry === void 0 ? void 0 : entry.media) === null || _c === void 0 ? void 0 : _c.title,
|
|
345
|
+
episodes: (_d = entry === null || entry === void 0 ? void 0 : entry.media) === null || _d === void 0 ? void 0 : _d.episodes,
|
|
346
|
+
siteUrl: (_e = entry === null || entry === void 0 ? void 0 : entry.media) === null || _e === void 0 ? void 0 : _e.siteUrl,
|
|
347
|
+
progress: entry.progress,
|
|
348
|
+
status: entry === null || entry === void 0 ? void 0 : entry.status,
|
|
349
|
+
hiddenFromStatusLists: entry.hiddenFromStatusLists,
|
|
350
|
+
});
|
|
351
|
+
}));
|
|
352
|
+
switch (exportType) {
|
|
353
|
+
case 1:
|
|
354
|
+
yield saveJSONasCSV(mediaWithProgress, "anime");
|
|
355
|
+
break;
|
|
356
|
+
case 2:
|
|
357
|
+
yield saveJSONasJSON(mediaWithProgress, "anime");
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
console.error(`\nNo anime(s) found in your lists.`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
console.error(`\nMust login to use this feature.`);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function exportMangaList() {
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
var _a, _b;
|
|
373
|
+
if (yield isLoggedIn()) {
|
|
374
|
+
const mangaLists = yield fetcher(currentUserMangaList, {
|
|
375
|
+
id: yield currentUsersId(),
|
|
376
|
+
});
|
|
377
|
+
if (mangaLists) {
|
|
378
|
+
const lists = ((_b = (_a = mangaLists === null || mangaLists === void 0 ? void 0 : mangaLists.data) === null || _a === void 0 ? void 0 : _a.MediaListCollection) === null || _b === void 0 ? void 0 : _b.lists) || [];
|
|
379
|
+
if (lists.length > 0) {
|
|
380
|
+
const { exportType } = yield inquirer.prompt([
|
|
381
|
+
{
|
|
382
|
+
type: "list",
|
|
383
|
+
name: "exportType",
|
|
384
|
+
message: "Choose export type:",
|
|
385
|
+
choices: [
|
|
386
|
+
{ name: "CSV", value: 1 },
|
|
387
|
+
{ name: "JSON", value: 2 },
|
|
388
|
+
],
|
|
389
|
+
pageSize: 10,
|
|
390
|
+
},
|
|
391
|
+
]);
|
|
392
|
+
const mediaWithProgress = lists.flatMap((list) => list.entries.map((entry) => {
|
|
393
|
+
var _a, _b, _c;
|
|
394
|
+
return ({
|
|
395
|
+
id: (_a = entry === null || entry === void 0 ? void 0 : entry.media) === null || _a === void 0 ? void 0 : _a.id,
|
|
396
|
+
title: exportType === 1
|
|
397
|
+
? getTitle((_b = entry === null || entry === void 0 ? void 0 : entry.media) === null || _b === void 0 ? void 0 : _b.title)
|
|
398
|
+
: (_c = entry === null || entry === void 0 ? void 0 : entry.media) === null || _c === void 0 ? void 0 : _c.title,
|
|
399
|
+
private: entry.private,
|
|
400
|
+
chapters: entry.media.chapters,
|
|
401
|
+
progress: entry.progress,
|
|
402
|
+
status: entry === null || entry === void 0 ? void 0 : entry.status,
|
|
403
|
+
hiddenFromStatusLists: entry.hiddenFromStatusLists,
|
|
270
404
|
});
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
405
|
+
}));
|
|
406
|
+
switch (exportType) {
|
|
407
|
+
case 1:
|
|
408
|
+
yield saveJSONasCSV(mediaWithProgress, "manga");
|
|
409
|
+
break;
|
|
410
|
+
case 2:
|
|
411
|
+
yield saveJSONasJSON(mediaWithProgress, "manga");
|
|
412
|
+
break;
|
|
275
413
|
}
|
|
276
414
|
}
|
|
415
|
+
else {
|
|
416
|
+
console.log(`\nList seems to be empty.`);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
console.error(`\nCould not get manga list.`);
|
|
277
421
|
}
|
|
278
422
|
}
|
|
279
423
|
else {
|
|
280
|
-
console.error(
|
|
424
|
+
console.error(`\nPlease login to use this feature.`);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function importAnimeList() {
|
|
429
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
try {
|
|
431
|
+
const { source } = yield inquirer.prompt([
|
|
432
|
+
{
|
|
433
|
+
type: "list",
|
|
434
|
+
name: "source",
|
|
435
|
+
message: "Select a source:",
|
|
436
|
+
choices: [{ name: "Exported JSON file.", value: 1 }],
|
|
437
|
+
pageSize: 10,
|
|
438
|
+
},
|
|
439
|
+
]);
|
|
440
|
+
switch (source) {
|
|
441
|
+
case 1:
|
|
442
|
+
yield importAnimeListFromExportedJSON();
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
console.error(`\n${error.message}`);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function importMangaList() {
|
|
452
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
453
|
+
try {
|
|
454
|
+
const { source } = yield inquirer.prompt([
|
|
455
|
+
{
|
|
456
|
+
type: "list",
|
|
457
|
+
name: "source",
|
|
458
|
+
message: "Select a source:",
|
|
459
|
+
choices: [{ name: "Exported JSON file.", value: 1 }],
|
|
460
|
+
pageSize: 10,
|
|
461
|
+
},
|
|
462
|
+
]);
|
|
463
|
+
switch (source) {
|
|
464
|
+
case 1:
|
|
465
|
+
yield importMangaListFromExportedJSON();
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
catch (error) {
|
|
470
|
+
console.error(`\n${error.message}`);
|
|
281
471
|
}
|
|
282
472
|
});
|
|
283
473
|
}
|
|
284
|
-
export { getUserInfoByUsername, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, deleteUserActivities, };
|
|
474
|
+
export { getUserInfoByUsername, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, deleteUserActivities, writeTextActivity, exportAnimeList, exportMangaList, importAnimeList, importMangaList, };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
declare const addAnimeToListMutation = "\nmutation($mediaId: Int, $status: MediaListStatus) {\n SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }\n}\n";
|
|
2
2
|
declare const addMangaToListMutation = "\n mutation($mediaId: Int, $status: MediaListStatus) {\n SaveMediaListEntry(mediaId: $mediaId, status: $status) {\n id\n status\n media { id title { romaji english } }\n }\n }\n";
|
|
3
3
|
declare const deleteActivityMutation = "\nmutation($id: Int!) {\n DeleteActivity(id: $id) { deleted }\n}\n";
|
|
4
|
-
|
|
4
|
+
declare const saveTextActivityMutation = "\nmutation SaveTextActivity($status: String!) {\n SaveTextActivity(text: $status) { id text userId createdAt }\n}\n";
|
|
5
|
+
declare const saveAnimeWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {\n SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {\n id progress hiddenFromStatusLists\n }\n}\n";
|
|
6
|
+
declare const saveMangaWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {\n SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private\n ) { id progress hiddenFromStatusLists private }\n}\n";
|
|
7
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, };
|
package/bin/helpers/mutations.js
CHANGED
|
@@ -17,4 +17,22 @@ mutation($id: Int!) {
|
|
|
17
17
|
DeleteActivity(id: $id) { deleted }
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
|
-
|
|
20
|
+
const saveTextActivityMutation = `
|
|
21
|
+
mutation SaveTextActivity($status: String!) {
|
|
22
|
+
SaveTextActivity(text: $status) { id text userId createdAt }
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const saveAnimeWithProgressMutation = `
|
|
26
|
+
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
|
|
27
|
+
SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
|
|
28
|
+
id progress hiddenFromStatusLists
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const saveMangaWithProgressMutation = `
|
|
33
|
+
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
|
|
34
|
+
SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
|
|
35
|
+
) { id progress hiddenFromStatusLists private }
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, };
|
package/bin/helpers/queries.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
declare const currentUserQuery = "{\n Viewer {\n id name about bans siteUrl options { profileColor timezone activityMergeTime }\n donatorTier donatorBadge createdAt updatedAt unreadNotificationCount
|
|
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}";
|
|
2
2
|
declare const trendingQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
3
3
|
declare const popularQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
4
4
|
declare const userQuery = "query ($username: String) {\n User(name: $username) {\n id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }\n isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }\n statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }\n }\n}";
|
|
5
|
-
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id media { id title { romaji english } } } }\n }\n}";
|
|
6
|
-
declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists {
|
|
5
|
+
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id title { romaji english } status episodes siteUrl } } }\n }\n}\n";
|
|
6
|
+
declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id title { romaji english } status chapters } } }\n }\n}\n";
|
|
7
7
|
declare const deleteMediaEntryMutation = "mutation($id: Int!) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
8
|
-
declare const deleteMangaEntryMutation = "mutation
|
|
8
|
+
declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
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
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}";
|
|
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
|
-
declare const activityTextQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: TEXT) {\n ... on TextActivity { id type text createdAt user { id name } }\n }\n }\n}";
|
|
15
|
-
declare const activityAnimeListQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: ANIME_LIST) {\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n }\n }\n}";
|
|
16
|
-
declare const activityMangaListQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MANGA_LIST) {\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n }\n }\n}";
|
|
17
|
-
declare const activityMessageQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MESSAGE) {\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
18
|
-
declare const activityAllQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId) {\n ... on TextActivity { id type text createdAt user { id name } }\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
19
|
-
declare const activityMediaList = "query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {\n Page(page: $page, perPage: $perPage) {\n pageInfo { total currentPage lastPage hasNextPage perPage }\n activities(userId: $userId, type: $type) {\n ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }\n }\n }\n}";
|
|
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
|
+
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}";
|
|
16
|
+
declare const activityMangaListQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n }\n }\n}";
|
|
17
|
+
declare const activityMessageQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
18
|
+
declare const activityAllQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, sort: ID_DESC) {\n ... on TextActivity { id type text createdAt user { id name } }\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
|
|
19
|
+
declare const activityMediaList = "query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {\n Page(page: $page, perPage: $perPage) {\n pageInfo { total currentPage lastPage hasNextPage perPage }\n activities(userId: $userId, type: $type, sort: ID_DESC) {\n ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }\n }\n }\n}";
|
|
20
20
|
export { currentUserQuery, trendingQuery, popularQuery, userQuery, currentUserAnimeList, currentUserMangaList, deleteMediaEntryMutation, deleteMangaEntryMutation, upcomingAnimesQuery, animeDetailsQuery, userActivityQuery, animeSearchQuery, mangaSearchQuery, activityAllQuery, activityMediaList, activityAnimeListQuery, activityMangaListQuery, activityMessageQuery, activityTextQuery, };
|
package/bin/helpers/queries.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const currentUserQuery = `{
|
|
2
2
|
Viewer {
|
|
3
3
|
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
|
-
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount
|
|
5
|
-
|
|
6
|
-
favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } }
|
|
7
|
-
}
|
|
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 } } } }
|
|
8
6
|
statistics { anime { count meanScore minutesWatched } manga { count chaptersRead volumesRead } }
|
|
9
7
|
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
10
8
|
}
|
|
@@ -28,31 +26,20 @@ const userQuery = `query ($username: String) {
|
|
|
28
26
|
}`;
|
|
29
27
|
const currentUserAnimeList = `query ($id: Int) {
|
|
30
28
|
MediaListCollection(userId: $id, type: ANIME) {
|
|
31
|
-
lists { name entries { id media { id title { romaji english } } } }
|
|
29
|
+
lists { name entries { id progress hiddenFromStatusLists status media { id title { romaji english } status episodes siteUrl } } }
|
|
32
30
|
}
|
|
33
|
-
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
34
33
|
const currentUserMangaList = `query ($id: Int) {
|
|
35
34
|
MediaListCollection(userId: $id, type: MANGA) {
|
|
36
|
-
lists {
|
|
37
|
-
name
|
|
38
|
-
entries {
|
|
39
|
-
id
|
|
40
|
-
media {
|
|
41
|
-
id
|
|
42
|
-
title {
|
|
43
|
-
romaji
|
|
44
|
-
english
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
35
|
+
lists { name entries { id progress hiddenFromStatusLists private status media { id title { romaji english } status chapters } } }
|
|
49
36
|
}
|
|
50
37
|
}
|
|
51
38
|
`;
|
|
52
39
|
const deleteMediaEntryMutation = `mutation($id: Int!) {
|
|
53
40
|
DeleteMediaListEntry(id: $id) { deleted }
|
|
54
41
|
}`;
|
|
55
|
-
const deleteMangaEntryMutation = `mutation
|
|
42
|
+
const deleteMangaEntryMutation = `mutation($id: Int) {
|
|
56
43
|
DeleteMediaListEntry(id: $id) { deleted }
|
|
57
44
|
}`;
|
|
58
45
|
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
@@ -89,35 +76,35 @@ const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
|
89
76
|
}`;
|
|
90
77
|
const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
91
78
|
Page(page: $page, perPage: $perPage) {
|
|
92
|
-
activities(userId: $userId, type: TEXT) {
|
|
79
|
+
activities(userId: $userId, type: TEXT, sort: ID_DESC) {
|
|
93
80
|
... on TextActivity { id type text createdAt user { id name } }
|
|
94
81
|
}
|
|
95
82
|
}
|
|
96
83
|
}`;
|
|
97
84
|
const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
98
85
|
Page(page: $page, perPage: $perPage) {
|
|
99
|
-
activities(userId: $userId, type: ANIME_LIST) {
|
|
86
|
+
activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
|
|
100
87
|
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
101
88
|
}
|
|
102
89
|
}
|
|
103
90
|
}`;
|
|
104
91
|
const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
105
92
|
Page(page: $page, perPage: $perPage) {
|
|
106
|
-
activities(userId: $userId, type: MANGA_LIST) {
|
|
93
|
+
activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
|
|
107
94
|
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
108
95
|
}
|
|
109
96
|
}
|
|
110
97
|
}`;
|
|
111
98
|
const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
112
99
|
Page(page: $page, perPage: $perPage) {
|
|
113
|
-
activities(userId: $userId, type: MESSAGE) {
|
|
100
|
+
activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
|
|
114
101
|
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
115
102
|
}
|
|
116
103
|
}
|
|
117
104
|
}`;
|
|
118
105
|
const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
119
106
|
Page(page: $page, perPage: $perPage) {
|
|
120
|
-
activities(userId: $userId) {
|
|
107
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
121
108
|
... on TextActivity { id type text createdAt user { id name } }
|
|
122
109
|
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
123
110
|
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
@@ -127,7 +114,7 @@ const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
|
127
114
|
const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
|
|
128
115
|
Page(page: $page, perPage: $perPage) {
|
|
129
116
|
pageInfo { total currentPage lastPage hasNextPage perPage }
|
|
130
|
-
activities(userId: $userId, type: $type) {
|
|
117
|
+
activities(userId: $userId, type: $type, sort: ID_DESC) {
|
|
131
118
|
... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
|
|
132
119
|
}
|
|
133
120
|
}
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -14,4 +14,18 @@ declare function getNextSeasonAndYear(): {
|
|
|
14
14
|
nextYear: number;
|
|
15
15
|
};
|
|
16
16
|
declare function removeHtmlAndMarkdown(input: string): string;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Export JSON as JSON
|
|
19
|
+
* @param js0n
|
|
20
|
+
* @param dataType (eg: anime/manga)
|
|
21
|
+
*/
|
|
22
|
+
declare function saveJSONasJSON(js0n: object, dataType: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Export JSON as CSV
|
|
25
|
+
* @param js0n
|
|
26
|
+
* @param dataType (eg: anime/manga)
|
|
27
|
+
*/
|
|
28
|
+
declare function saveJSONasCSV(js0n: object, dataType: string): Promise<void>;
|
|
29
|
+
declare function importAnimeListFromExportedJSON(): Promise<void>;
|
|
30
|
+
declare function importMangaListFromExportedJSON(): Promise<void>;
|
|
31
|
+
export { aniListEndpoint, redirectUri, getTitle, getNextSeasonAndYear, formatDateObject, removeHtmlAndMarkdown, saveJSONasJSON, saveJSONasCSV, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, };
|