@irfanshadikrishad/anilist 1.0.6 → 1.0.8
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/README.md +2 -2
- package/bin/helpers/auth.d.ts +2 -2
- package/bin/helpers/auth.js +49 -36
- package/bin/helpers/fetcher.js +2 -3
- package/bin/helpers/lists.d.ts +1 -1
- package/bin/helpers/lists.js +42 -64
- package/bin/helpers/more.d.ts +1 -1
- package/bin/helpers/more.js +112 -86
- package/bin/helpers/mutations.d.ts +1 -1
- package/bin/helpers/mutations.js +1 -1
- package/bin/helpers/queries.d.ts +5 -3
- package/bin/helpers/queries.js +13 -3
- package/bin/helpers/types.d.ts +111 -0
- package/bin/helpers/types.js +26 -0
- package/bin/helpers/workers.d.ts +9 -1
- package/bin/helpers/workers.js +403 -53
- package/bin/index.js +3 -2
- package/package.json +15 -4
- package/CHANGELOG.md +0 -10
- package/CODE_OF_CONDUCT.md +0 -43
- package/CONTRIBUTING.md +0 -75
package/bin/helpers/more.js
CHANGED
|
@@ -7,22 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import inquirer from "inquirer";
|
|
10
11
|
import fetch from "node-fetch";
|
|
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, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, } from "./workers.js";
|
|
14
13
|
import { fetcher } from "./fetcher.js";
|
|
15
|
-
import inquirer from "inquirer";
|
|
16
14
|
import { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, } from "./mutations.js";
|
|
15
|
+
import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, mangaSearchQuery, userActivityQuery, userQuery, } from "./queries.js";
|
|
16
|
+
import { aniListEndpoint, formatDateObject, getTitle, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, MALexport, MALimport, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, } from "./workers.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;
|
|
20
20
|
try {
|
|
21
|
-
const
|
|
22
|
-
let headers = {
|
|
21
|
+
const headers = {
|
|
23
22
|
"content-type": "application/json",
|
|
24
23
|
};
|
|
25
|
-
if (
|
|
24
|
+
if (yield isLoggedIn()) {
|
|
26
25
|
headers["Authorization"] = `Bearer ${yield retriveAccessToken()}`;
|
|
27
26
|
}
|
|
28
27
|
const request = yield fetch(aniListEndpoint, {
|
|
@@ -44,9 +43,8 @@ function getUserInfoByUsername(username) {
|
|
|
44
43
|
console.log(`siteUrl:\t${user === null || user === void 0 ? void 0 : user.siteUrl}`);
|
|
45
44
|
console.log(`Donator Tier:\t${user === null || user === void 0 ? void 0 : user.donatorTier}`);
|
|
46
45
|
console.log(`Donator Badge:\t${user === null || user === void 0 ? void 0 : user.donatorBadge}`);
|
|
47
|
-
{
|
|
48
|
-
(
|
|
49
|
-
console.log(`Account Created:${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}`);
|
|
46
|
+
if (user === null || user === void 0 ? void 0 : user.createdAt) {
|
|
47
|
+
console.log(`Account Created: ${new Date(user.createdAt * 1000).toUTCString()}`);
|
|
50
48
|
}
|
|
51
49
|
console.log(`Account Updated:${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}`);
|
|
52
50
|
console.log(`I blocked?\t${user === null || user === void 0 ? void 0 : user.isBlocked}`);
|
|
@@ -57,12 +55,11 @@ function getUserInfoByUsername(username) {
|
|
|
57
55
|
console.log(`\nStatistics (Anime)\nCount: ${(_g = (_f = user === null || user === void 0 ? void 0 : user.statistics) === null || _f === void 0 ? void 0 : _f.anime) === null || _g === void 0 ? void 0 : _g.count} episodesWatched: ${(_j = (_h = user === null || user === void 0 ? void 0 : user.statistics) === null || _h === void 0 ? void 0 : _h.anime) === null || _j === void 0 ? void 0 : _j.episodesWatched} minutesWatched: ${(_l = (_k = user === null || user === void 0 ? void 0 : user.statistics) === null || _k === void 0 ? void 0 : _k.anime) === null || _l === void 0 ? void 0 : _l.minutesWatched}`);
|
|
58
56
|
console.log(`Statistics (Manga)\nCount: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.manga) === null || _o === void 0 ? void 0 : _o.count} Chapter Read: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.manga) === null || _q === void 0 ? void 0 : _q.chaptersRead} Volumes Read: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.manga) === null || _s === void 0 ? void 0 : _s.volumesRead}`);
|
|
59
57
|
console.log(`\nRecent Activities:`);
|
|
60
|
-
activities.length > 0
|
|
61
|
-
activities.map(({
|
|
62
|
-
progress
|
|
63
|
-
? console.log(`${status} ${progress} of ${getTitle(media === null || media === void 0 ? void 0 : media.title)}`)
|
|
64
|
-
: console.log(`${status} ${getTitle(media === null || media === void 0 ? void 0 : media.title)}`);
|
|
58
|
+
if (activities.length > 0) {
|
|
59
|
+
activities.map(({ status, progress, media }) => {
|
|
60
|
+
console.log(`${status} ${progress ? `${progress} of ` : ""}${getTitle(media === null || media === void 0 ? void 0 : media.title)}`);
|
|
65
61
|
});
|
|
62
|
+
}
|
|
66
63
|
}
|
|
67
64
|
else {
|
|
68
65
|
console.error(`\n${request.status} ${(_t = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _t === void 0 ? void 0 : _t.message}`);
|
|
@@ -76,11 +73,11 @@ function getUserInfoByUsername(username) {
|
|
|
76
73
|
function getAnimeDetailsByID(anilistID) {
|
|
77
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
75
|
var _a;
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const query = animeDetailsQuery;
|
|
77
|
+
const variables = { id: anilistID };
|
|
81
78
|
const details = yield fetcher(query, variables);
|
|
82
|
-
if (details) {
|
|
83
|
-
const { id,
|
|
79
|
+
if ((_a = details === null || details === void 0 ? void 0 : details.data) === null || _a === void 0 ? void 0 : _a.Media) {
|
|
80
|
+
const { id, title, description, duration, startDate, endDate, countryOfOrigin, isAdult, status, season, format, genres, siteUrl, } = details.data.Media;
|
|
84
81
|
console.log(`\nID: ${id}`);
|
|
85
82
|
console.log(`Title: ${(title === null || title === void 0 ? void 0 : title.userPreffered) || getTitle(title)}`);
|
|
86
83
|
console.log(`Description: ${removeHtmlAndMarkdown(description)}`);
|
|
@@ -134,8 +131,7 @@ function getAnimeSearchResults(search, count) {
|
|
|
134
131
|
},
|
|
135
132
|
]);
|
|
136
133
|
// Lets save to the list now
|
|
137
|
-
|
|
138
|
-
if (ISLOGGEDIN) {
|
|
134
|
+
if (yield isLoggedIn()) {
|
|
139
135
|
const query = addAnimeToListMutation;
|
|
140
136
|
const variables = { mediaId: selectedList, status: selectedListType };
|
|
141
137
|
const response = yield fetcher(query, variables);
|
|
@@ -194,8 +190,7 @@ function getMangaSearchResults(search, count) {
|
|
|
194
190
|
},
|
|
195
191
|
]);
|
|
196
192
|
// If logged in save to the list
|
|
197
|
-
|
|
198
|
-
if (ISLOGGEDIN) {
|
|
193
|
+
if (yield isLoggedIn()) {
|
|
199
194
|
const mutation = addMangaToListMutation;
|
|
200
195
|
const variables = { mediaId: selectedMangaId, status: selectedListType };
|
|
201
196
|
const response = yield fetcher(mutation, variables);
|
|
@@ -215,9 +210,8 @@ function getMangaSearchResults(search, count) {
|
|
|
215
210
|
}
|
|
216
211
|
function deleteUserActivities() {
|
|
217
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
-
var _a, _b, _c, _d;
|
|
219
|
-
|
|
220
|
-
if (LOGGEDIN) {
|
|
213
|
+
var _a, _b, _c, _d, _e, _f;
|
|
214
|
+
if (yield isLoggedIn()) {
|
|
221
215
|
const { activityType } = yield inquirer.prompt([
|
|
222
216
|
{
|
|
223
217
|
type: "list",
|
|
@@ -233,51 +227,52 @@ function deleteUserActivities() {
|
|
|
233
227
|
],
|
|
234
228
|
},
|
|
235
229
|
]);
|
|
236
|
-
let query = ``;
|
|
237
230
|
const userId = yield currentUsersId();
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
console.log(`${activityID} ${isDeleted ? "✅" : "❌"}`);
|
|
276
|
-
// avoiding rate-limit
|
|
277
|
-
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
231
|
+
const variables = { page: 1, perPage: 100, userId };
|
|
232
|
+
const queryMap = {
|
|
233
|
+
0: activityAllQuery,
|
|
234
|
+
1: activityTextQuery,
|
|
235
|
+
2: activityMediaList,
|
|
236
|
+
3: activityAnimeListQuery,
|
|
237
|
+
4: activityMangaListQuery,
|
|
238
|
+
5: activityMessageQuery,
|
|
239
|
+
};
|
|
240
|
+
const query = queryMap[activityType];
|
|
241
|
+
let hasMoreActivities = true;
|
|
242
|
+
while (hasMoreActivities) {
|
|
243
|
+
const response = yield fetcher(query, {
|
|
244
|
+
page: 1,
|
|
245
|
+
perPage: 50,
|
|
246
|
+
userId: yield currentUsersId(),
|
|
247
|
+
});
|
|
248
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities) {
|
|
249
|
+
let count = 0;
|
|
250
|
+
const activities = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
|
|
251
|
+
if (!activities || activities.length === 0) {
|
|
252
|
+
console.log(`\nNo more activities available.`);
|
|
253
|
+
hasMoreActivities = false;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
for (const act of activities) {
|
|
257
|
+
// Ensure ID is present to avoid unintended errors
|
|
258
|
+
if (act === null || act === void 0 ? void 0 : act.id) {
|
|
259
|
+
const deleteResponse = yield fetcher(deleteActivityMutation, {
|
|
260
|
+
id: act === null || act === void 0 ? void 0 : act.id,
|
|
261
|
+
});
|
|
262
|
+
const isDeleted = (_f = (_e = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _e === void 0 ? void 0 : _e.DeleteActivity) === null || _f === void 0 ? void 0 : _f.deleted;
|
|
263
|
+
count++;
|
|
264
|
+
console.log(`[${count}/${activities.length}] ${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? "✅" : "❌"}`);
|
|
265
|
+
// Avoiding rate-limit
|
|
266
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
267
|
+
}
|
|
278
268
|
}
|
|
279
269
|
}
|
|
280
270
|
}
|
|
271
|
+
else {
|
|
272
|
+
// In case of an unexpected null response, exit the loop
|
|
273
|
+
console.log(`\nProbably deleted all the activities of this type.`);
|
|
274
|
+
hasMoreActivities = false;
|
|
275
|
+
}
|
|
281
276
|
}
|
|
282
277
|
}
|
|
283
278
|
else {
|
|
@@ -289,24 +284,23 @@ function writeTextActivity(status) {
|
|
|
289
284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
290
285
|
var _a;
|
|
291
286
|
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 {
|
|
287
|
+
if (!(yield isLoggedIn())) {
|
|
309
288
|
console.error(`\nPlease login to use this feature.`);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const query = saveTextActivityMutation;
|
|
292
|
+
const variables = {
|
|
293
|
+
status: status +
|
|
294
|
+
`<br><br><br><br>*Written using [@irfanshadikrishad/anilist](https://www.npmjs.com/package/@irfanshadikrishad/anilist).*`,
|
|
295
|
+
};
|
|
296
|
+
const data = yield fetcher(query, variables);
|
|
297
|
+
if (!data) {
|
|
298
|
+
console.error(`\nSomething went wrong. ${data}.`);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const savedActivity = (_a = data.data) === null || _a === void 0 ? void 0 : _a.SaveTextActivity;
|
|
302
|
+
if (savedActivity === null || savedActivity === void 0 ? void 0 : savedActivity.id) {
|
|
303
|
+
console.log(`\n[${savedActivity.id}] status saved successfully!`);
|
|
310
304
|
}
|
|
311
305
|
}
|
|
312
306
|
catch (error) {
|
|
@@ -326,6 +320,7 @@ function exportAnimeList() {
|
|
|
326
320
|
choices: [
|
|
327
321
|
{ name: "CSV", value: 1 },
|
|
328
322
|
{ name: "JSON", value: 2 },
|
|
323
|
+
{ name: "XML (MyAnimeList)", value: 3 },
|
|
329
324
|
],
|
|
330
325
|
pageSize: 10,
|
|
331
326
|
},
|
|
@@ -356,6 +351,12 @@ function exportAnimeList() {
|
|
|
356
351
|
case 2:
|
|
357
352
|
yield saveJSONasJSON(mediaWithProgress, "anime");
|
|
358
353
|
break;
|
|
354
|
+
case 3:
|
|
355
|
+
yield MALexport.Anime();
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
console.log(`\nInvalid export type. ${exportType}`);
|
|
359
|
+
break;
|
|
359
360
|
}
|
|
360
361
|
}
|
|
361
362
|
else {
|
|
@@ -385,6 +386,7 @@ function exportMangaList() {
|
|
|
385
386
|
choices: [
|
|
386
387
|
{ name: "CSV", value: 1 },
|
|
387
388
|
{ name: "JSON", value: 2 },
|
|
389
|
+
{ name: "XML (MyAnimeList)", value: 3 },
|
|
388
390
|
],
|
|
389
391
|
pageSize: 10,
|
|
390
392
|
},
|
|
@@ -410,6 +412,12 @@ function exportMangaList() {
|
|
|
410
412
|
case 2:
|
|
411
413
|
yield saveJSONasJSON(mediaWithProgress, "manga");
|
|
412
414
|
break;
|
|
415
|
+
case 3:
|
|
416
|
+
yield MALexport.Manga();
|
|
417
|
+
break;
|
|
418
|
+
default:
|
|
419
|
+
console.log(`\nInvalid export type. ${exportType}`);
|
|
420
|
+
break;
|
|
413
421
|
}
|
|
414
422
|
}
|
|
415
423
|
else {
|
|
@@ -433,7 +441,10 @@ function importAnimeList() {
|
|
|
433
441
|
type: "list",
|
|
434
442
|
name: "source",
|
|
435
443
|
message: "Select a source:",
|
|
436
|
-
choices: [
|
|
444
|
+
choices: [
|
|
445
|
+
{ name: "Exported JSON file.", value: 1 },
|
|
446
|
+
{ name: "MyAnimeList (XML)", value: 2 },
|
|
447
|
+
],
|
|
437
448
|
pageSize: 10,
|
|
438
449
|
},
|
|
439
450
|
]);
|
|
@@ -441,6 +452,12 @@ function importAnimeList() {
|
|
|
441
452
|
case 1:
|
|
442
453
|
yield importAnimeListFromExportedJSON();
|
|
443
454
|
break;
|
|
455
|
+
case 2:
|
|
456
|
+
yield MALimport.Anime();
|
|
457
|
+
break;
|
|
458
|
+
default:
|
|
459
|
+
console.log(`\nInvalid Choice.`);
|
|
460
|
+
break;
|
|
444
461
|
}
|
|
445
462
|
}
|
|
446
463
|
catch (error) {
|
|
@@ -456,7 +473,10 @@ function importMangaList() {
|
|
|
456
473
|
type: "list",
|
|
457
474
|
name: "source",
|
|
458
475
|
message: "Select a source:",
|
|
459
|
-
choices: [
|
|
476
|
+
choices: [
|
|
477
|
+
{ name: "Exported JSON file.", value: 1 },
|
|
478
|
+
{ name: "MyAnimeList (XML)", value: 2 },
|
|
479
|
+
],
|
|
460
480
|
pageSize: 10,
|
|
461
481
|
},
|
|
462
482
|
]);
|
|
@@ -464,6 +484,12 @@ function importMangaList() {
|
|
|
464
484
|
case 1:
|
|
465
485
|
yield importMangaListFromExportedJSON();
|
|
466
486
|
break;
|
|
487
|
+
case 2:
|
|
488
|
+
yield MALimport.Manga();
|
|
489
|
+
break;
|
|
490
|
+
default:
|
|
491
|
+
console.log(`\nInvalid Choice.`);
|
|
492
|
+
break;
|
|
467
493
|
}
|
|
468
494
|
}
|
|
469
495
|
catch (error) {
|
|
@@ -471,4 +497,4 @@ function importMangaList() {
|
|
|
471
497
|
}
|
|
472
498
|
});
|
|
473
499
|
}
|
|
474
|
-
export {
|
|
500
|
+
export { deleteUserActivities, exportAnimeList, exportMangaList, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, getUserInfoByUsername, importAnimeList, importMangaList, writeTextActivity, };
|
|
@@ -4,4 +4,4 @@ declare const deleteActivityMutation = "\nmutation($id: Int!) {\n DeleteActivit
|
|
|
4
4
|
declare const saveTextActivityMutation = "\nmutation SaveTextActivity($status: String!) {\n SaveTextActivity(text: $status) { id text userId createdAt }\n}\n";
|
|
5
5
|
declare const saveAnimeWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {\n SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {\n id progress hiddenFromStatusLists\n }\n}\n";
|
|
6
6
|
declare const saveMangaWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {\n SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private\n ) { id progress hiddenFromStatusLists private }\n}\n";
|
|
7
|
-
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation,
|
|
7
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
|
package/bin/helpers/mutations.js
CHANGED
|
@@ -35,4 +35,4 @@ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromSt
|
|
|
35
35
|
) { id progress hiddenFromStatusLists private }
|
|
36
36
|
}
|
|
37
37
|
`;
|
|
38
|
-
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation,
|
|
38
|
+
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
|
package/bin/helpers/queries.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ declare const currentUserQuery = "{\n Viewer {\n id name about bans siteUrl
|
|
|
2
2
|
declare const trendingQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
3
3
|
declare const popularQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
|
|
4
4
|
declare const userQuery = "query ($username: String) {\n User(name: $username) {\n id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }\n isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }\n statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }\n }\n}";
|
|
5
|
-
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id 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";
|
|
5
|
+
declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }\n }\n}\n";
|
|
6
|
+
declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }\n }\n}\n";
|
|
7
7
|
declare const deleteMediaEntryMutation = "mutation($id: Int!) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
|
|
8
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}";
|
|
@@ -17,4 +17,6 @@ declare const activityMangaListQuery = "query ($userId: Int, $page: Int, $perPag
|
|
|
17
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
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
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
|
+
declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $malId, type: ANIME) {\n id title { romaji english } } \n}\n";
|
|
21
|
+
declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $malId, type: MANGA) {\n id title { romaji english } } \n}\n";
|
|
22
|
+
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };
|
package/bin/helpers/queries.js
CHANGED
|
@@ -26,13 +26,13 @@ const userQuery = `query ($username: String) {
|
|
|
26
26
|
}`;
|
|
27
27
|
const currentUserAnimeList = `query ($id: Int) {
|
|
28
28
|
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
-
lists { name entries { id progress hiddenFromStatusLists status media { id title { romaji english } status episodes siteUrl } } }
|
|
29
|
+
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
const currentUserMangaList = `query ($id: Int) {
|
|
34
34
|
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
-
lists { name entries { id progress hiddenFromStatusLists private status media { id title { romaji english } status chapters } } }
|
|
35
|
+
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
`;
|
|
@@ -119,4 +119,14 @@ const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}`;
|
|
122
|
-
|
|
122
|
+
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
+
Media(idMal: $malId, type: ANIME) {
|
|
124
|
+
id title { romaji english } }
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
+
Media(idMal: $malId, type: MANGA) {
|
|
129
|
+
id title { romaji english } }
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
interface DeleteMangaResponse {
|
|
2
|
+
data?: {
|
|
3
|
+
DeleteMediaListEntry?: {
|
|
4
|
+
deleted?: boolean;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
errors?: {
|
|
8
|
+
message: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
declare enum AniListMediaStatus {
|
|
12
|
+
CURRENT = "CURRENT",
|
|
13
|
+
PLANNING = "PLANNING",
|
|
14
|
+
COMPLETED = "COMPLETED",
|
|
15
|
+
DROPPED = "DROPPED",
|
|
16
|
+
PAUSED = "PAUSED",
|
|
17
|
+
REPEATING = "REPEATING"
|
|
18
|
+
}
|
|
19
|
+
interface MALAnimeXML {
|
|
20
|
+
series_animedb_id: number;
|
|
21
|
+
series_title: string;
|
|
22
|
+
series_type: string;
|
|
23
|
+
series_episodes: number;
|
|
24
|
+
my_id: number;
|
|
25
|
+
my_watched_episodes: number;
|
|
26
|
+
my_start_date: string;
|
|
27
|
+
my_finish_date: string;
|
|
28
|
+
my_rated: string;
|
|
29
|
+
my_score: number;
|
|
30
|
+
my_storage: string;
|
|
31
|
+
my_storage_value: number;
|
|
32
|
+
my_status: string;
|
|
33
|
+
my_comments: string;
|
|
34
|
+
my_times_watched: number;
|
|
35
|
+
my_rewatch_value: string;
|
|
36
|
+
my_priority: string;
|
|
37
|
+
my_tags: string;
|
|
38
|
+
my_rewatching: number;
|
|
39
|
+
my_rewatching_ep: number;
|
|
40
|
+
my_discuss: number;
|
|
41
|
+
my_sns: string;
|
|
42
|
+
update_on_import: number;
|
|
43
|
+
}
|
|
44
|
+
interface MalIdToAnilistIdResponse {
|
|
45
|
+
data?: {
|
|
46
|
+
Media: {
|
|
47
|
+
id: number;
|
|
48
|
+
title: {
|
|
49
|
+
english?: string;
|
|
50
|
+
romaji?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
errors?: {
|
|
55
|
+
message: string;
|
|
56
|
+
}[];
|
|
57
|
+
}
|
|
58
|
+
interface saveAnimeWithProgressResponse {
|
|
59
|
+
data?: {
|
|
60
|
+
SaveMediaListEntry: {
|
|
61
|
+
id: number;
|
|
62
|
+
progress: number;
|
|
63
|
+
hiddenFromStatusLists: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
errors?: {
|
|
67
|
+
message: string;
|
|
68
|
+
}[];
|
|
69
|
+
}
|
|
70
|
+
declare enum MALAnimeStatus {
|
|
71
|
+
ON_HOLD = "On-Hold",
|
|
72
|
+
DROPPED = "Dropped",
|
|
73
|
+
COMPLETED = "Completed",
|
|
74
|
+
WATCHING = "Watching",
|
|
75
|
+
PLAN_TO_WATCH = "Plan to Watch"
|
|
76
|
+
}
|
|
77
|
+
declare enum MALMangaStatus {
|
|
78
|
+
ON_HOLD = "On-Hold",
|
|
79
|
+
DROPPED = "Dropped",
|
|
80
|
+
COMPLETED = "Completed",
|
|
81
|
+
READING = "Reading",
|
|
82
|
+
PLAN_TO_READ = "Plan to Read"
|
|
83
|
+
}
|
|
84
|
+
interface AnimeList {
|
|
85
|
+
data?: {
|
|
86
|
+
MediaListCollection: {
|
|
87
|
+
lists: [{
|
|
88
|
+
name: string;
|
|
89
|
+
entries: {
|
|
90
|
+
id: number;
|
|
91
|
+
progress: number;
|
|
92
|
+
};
|
|
93
|
+
}];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
errors?: {
|
|
97
|
+
message: string;
|
|
98
|
+
}[];
|
|
99
|
+
}
|
|
100
|
+
interface MediaWithProgress {
|
|
101
|
+
malId: number;
|
|
102
|
+
progress: number;
|
|
103
|
+
status: string;
|
|
104
|
+
episodes?: number;
|
|
105
|
+
chapters?: number;
|
|
106
|
+
title: {
|
|
107
|
+
english?: string;
|
|
108
|
+
romaji?: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export { AniListMediaStatus, AnimeList, DeleteMangaResponse, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaWithProgress, saveAnimeWithProgressResponse, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var AniListMediaStatus;
|
|
2
|
+
(function (AniListMediaStatus) {
|
|
3
|
+
AniListMediaStatus["CURRENT"] = "CURRENT";
|
|
4
|
+
AniListMediaStatus["PLANNING"] = "PLANNING";
|
|
5
|
+
AniListMediaStatus["COMPLETED"] = "COMPLETED";
|
|
6
|
+
AniListMediaStatus["DROPPED"] = "DROPPED";
|
|
7
|
+
AniListMediaStatus["PAUSED"] = "PAUSED";
|
|
8
|
+
AniListMediaStatus["REPEATING"] = "REPEATING";
|
|
9
|
+
})(AniListMediaStatus || (AniListMediaStatus = {}));
|
|
10
|
+
var MALAnimeStatus;
|
|
11
|
+
(function (MALAnimeStatus) {
|
|
12
|
+
MALAnimeStatus["ON_HOLD"] = "On-Hold";
|
|
13
|
+
MALAnimeStatus["DROPPED"] = "Dropped";
|
|
14
|
+
MALAnimeStatus["COMPLETED"] = "Completed";
|
|
15
|
+
MALAnimeStatus["WATCHING"] = "Watching";
|
|
16
|
+
MALAnimeStatus["PLAN_TO_WATCH"] = "Plan to Watch";
|
|
17
|
+
})(MALAnimeStatus || (MALAnimeStatus = {}));
|
|
18
|
+
var MALMangaStatus;
|
|
19
|
+
(function (MALMangaStatus) {
|
|
20
|
+
MALMangaStatus["ON_HOLD"] = "On-Hold";
|
|
21
|
+
MALMangaStatus["DROPPED"] = "Dropped";
|
|
22
|
+
MALMangaStatus["COMPLETED"] = "Completed";
|
|
23
|
+
MALMangaStatus["READING"] = "Reading";
|
|
24
|
+
MALMangaStatus["PLAN_TO_READ"] = "Plan to Read";
|
|
25
|
+
})(MALMangaStatus || (MALMangaStatus = {}));
|
|
26
|
+
export { AniListMediaStatus, MALAnimeStatus, MALMangaStatus, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -28,4 +28,12 @@ declare function saveJSONasJSON(js0n: object, dataType: string): Promise<void>;
|
|
|
28
28
|
declare function saveJSONasCSV(js0n: object, dataType: string): Promise<void>;
|
|
29
29
|
declare function importAnimeListFromExportedJSON(): Promise<void>;
|
|
30
30
|
declare function importMangaListFromExportedJSON(): Promise<void>;
|
|
31
|
-
|
|
31
|
+
declare class MALimport {
|
|
32
|
+
static Anime(): Promise<void>;
|
|
33
|
+
static Manga(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
declare class MALexport {
|
|
36
|
+
static Anime(): Promise<void>;
|
|
37
|
+
static Manga(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export { aniListEndpoint, formatDateObject, getNextSeasonAndYear, getTitle, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, MALexport, MALimport, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, };
|