@irfanshadikrishad/anilist 1.2.0-forbidden.1 → 1.2.3-forbidden.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ import { homedir } from "os";
17
17
  import { join } from "path";
18
18
  import process from "process";
19
19
  import { Auth } from "./auth.js";
20
- import { MALAnimeStatus, MALMangaStatus } from "./types.js";
20
+ import { MALAnimeStatus, MALMangaStatus, } from "./types.js";
21
21
  const aniListEndpoint = `https://graphql.anilist.co`;
22
22
  const redirectUri = "https://anilist.co/api/v2/oauth/pin";
23
23
  function getTitle(title) {
@@ -170,49 +170,49 @@ function selectFile(fileType) {
170
170
  });
171
171
  }
172
172
  function createAnimeXML(malId, progress, status, episodes, title) {
173
- return `
174
- <anime>
175
- <series_animedb_id>${malId}</series_animedb_id>
176
- <series_title><![CDATA[${title}]]></series_title>
177
- <series_type>""</series_type>
178
- <series_episodes>${episodes}</series_episodes>
179
- <my_id>0</my_id>
180
- <my_watched_episodes>${progress}</my_watched_episodes>
181
- <my_start_date>0000-00-00</my_start_date>
182
- <my_finish_date>0000-00-00</my_finish_date>
183
- <my_score>0</my_score>
184
- <my_storage_value>0.00</my_storage_value>
185
- <my_status>${status}</my_status>
186
- <my_comments><![CDATA[]]></my_comments>
187
- <my_times_watched>0</my_times_watched>
188
- <my_rewatch_value></my_rewatch_value>
189
- <my_priority>LOW</my_priority>
190
- <my_tags><![CDATA[]]></my_tags>
191
- <my_rewatching>0</my_rewatching>
192
- <my_rewatching_ep>0</my_rewatching_ep>
193
- <my_discuss>0</my_discuss>
194
- <my_sns>default</my_sns>
195
- <update_on_import>1</update_on_import>
173
+ return `
174
+ <anime>
175
+ <series_animedb_id>${malId}</series_animedb_id>
176
+ <series_title><![CDATA[${title}]]></series_title>
177
+ <series_type>""</series_type>
178
+ <series_episodes>${episodes}</series_episodes>
179
+ <my_id>0</my_id>
180
+ <my_watched_episodes>${progress}</my_watched_episodes>
181
+ <my_start_date>0000-00-00</my_start_date>
182
+ <my_finish_date>0000-00-00</my_finish_date>
183
+ <my_score>0</my_score>
184
+ <my_storage_value>0.00</my_storage_value>
185
+ <my_status>${status}</my_status>
186
+ <my_comments><![CDATA[]]></my_comments>
187
+ <my_times_watched>0</my_times_watched>
188
+ <my_rewatch_value></my_rewatch_value>
189
+ <my_priority>LOW</my_priority>
190
+ <my_tags><![CDATA[]]></my_tags>
191
+ <my_rewatching>0</my_rewatching>
192
+ <my_rewatching_ep>0</my_rewatching_ep>
193
+ <my_discuss>0</my_discuss>
194
+ <my_sns>default</my_sns>
195
+ <update_on_import>1</update_on_import>
196
196
  </anime>`;
197
197
  }
198
198
  function createMangaXML(malId, progress, status, chapters, title) {
199
- return `
200
- <manga>
201
- <manga_mangadb_id>${malId}</manga_mangadb_id>
202
- <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
203
- <manga_volumes>0</manga_volumes>
204
- <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
205
- <my_id>0</my_id>
206
- <my_read_chapters>${progress}</my_read_chapters>
207
- <my_start_date>0000-00-00</my_start_date>
208
- <my_finish_date>0000-00-00</my_finish_date>
209
- <my_score>0</my_score>
210
- <my_status>${status}</my_status>
211
- <my_reread_value></my_reread_value>
212
- <my_priority>LOW</my_priority>
213
- <my_rereading>0</my_rereading>
214
- <my_discuss>0</my_discuss>
215
- <update_on_import>1</update_on_import>
199
+ return `
200
+ <manga>
201
+ <manga_mangadb_id>${malId}</manga_mangadb_id>
202
+ <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
203
+ <manga_volumes>0</manga_volumes>
204
+ <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
205
+ <my_id>0</my_id>
206
+ <my_read_chapters>${progress}</my_read_chapters>
207
+ <my_start_date>0000-00-00</my_start_date>
208
+ <my_finish_date>0000-00-00</my_finish_date>
209
+ <my_score>0</my_score>
210
+ <my_status>${status}</my_status>
211
+ <my_reread_value></my_reread_value>
212
+ <my_priority>LOW</my_priority>
213
+ <my_rereading>0</my_rereading>
214
+ <my_discuss>0</my_discuss>
215
+ <update_on_import>1</update_on_import>
216
216
  </manga>`;
217
217
  }
218
218
  function createAnimeListXML(mediaWithProgress) {
@@ -232,19 +232,19 @@ function createAnimeListXML(mediaWithProgress) {
232
232
  const status = statusMap[anime.status];
233
233
  return createAnimeXML(malId, progress, status, episodes, title);
234
234
  });
235
- return `<myanimelist>
236
- <myinfo>
237
- <user_id/>
238
- <user_name>${yield Auth.MyUserName()}</user_name>
239
- <user_export_type>1</user_export_type>
240
- <user_total_anime>0</user_total_anime>
241
- <user_total_watching>0</user_total_watching>
242
- <user_total_completed>0</user_total_completed>
243
- <user_total_onhold>0</user_total_onhold>
244
- <user_total_dropped>0</user_total_dropped>
245
- <user_total_plantowatch>0</user_total_plantowatch>
246
- </myinfo>
247
- \n${xmlEntries.join("\n")}\n
235
+ return `<myanimelist>
236
+ <myinfo>
237
+ <user_id/>
238
+ <user_name>${yield Auth.MyUserName()}</user_name>
239
+ <user_export_type>1</user_export_type>
240
+ <user_total_anime>0</user_total_anime>
241
+ <user_total_watching>0</user_total_watching>
242
+ <user_total_completed>0</user_total_completed>
243
+ <user_total_onhold>0</user_total_onhold>
244
+ <user_total_dropped>0</user_total_dropped>
245
+ <user_total_plantowatch>0</user_total_plantowatch>
246
+ </myinfo>
247
+ \n${xmlEntries.join("\n")}\n
248
248
  </myanimelist>`;
249
249
  });
250
250
  }
@@ -265,19 +265,19 @@ function createMangaListXML(mediaWithProgress) {
265
265
  const status = statusMap[manga.status];
266
266
  return createMangaXML(malId, progress, status, chapters, title);
267
267
  });
268
- return `<myanimelist>
269
- <myinfo>
270
- <user_id/>
271
- <user_name>${yield Auth.MyUserName()}</user_name>
272
- <user_export_type>2</user_export_type>
273
- <user_total_manga>5</user_total_manga>
274
- <user_total_reading>1</user_total_reading>
275
- <user_total_completed>1</user_total_completed>
276
- <user_total_onhold>1</user_total_onhold>
277
- <user_total_dropped>1</user_total_dropped>
278
- <user_total_plantoread>1</user_total_plantoread>
279
- </myinfo>
280
- \n${xmlEntries.join("\n")}\n
268
+ return `<myanimelist>
269
+ <myinfo>
270
+ <user_id/>
271
+ <user_name>${yield Auth.MyUserName()}</user_name>
272
+ <user_export_type>2</user_export_type>
273
+ <user_total_manga>5</user_total_manga>
274
+ <user_total_reading>1</user_total_reading>
275
+ <user_total_completed>1</user_total_completed>
276
+ <user_total_onhold>1</user_total_onhold>
277
+ <user_total_dropped>1</user_total_dropped>
278
+ <user_total_plantoread>1</user_total_plantoread>
279
+ </myinfo>
280
+ \n${xmlEntries.join("\n")}\n
281
281
  </myanimelist>`;
282
282
  });
283
283
  }
@@ -287,4 +287,36 @@ function getCurrentPackageVersion() {
287
287
  const version = packageJson.version;
288
288
  return version || null;
289
289
  }
290
- export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
290
+ function timestampToTimeAgo(timestamp) {
291
+ const now = Math.floor(Date.now() / 1000);
292
+ const elapsed = now - timestamp;
293
+ if (elapsed < 60) {
294
+ return `${elapsed} second${elapsed === 1 ? "" : "s"} ago`;
295
+ }
296
+ else if (elapsed < 3600) {
297
+ const minutes = Math.floor(elapsed / 60);
298
+ return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
299
+ }
300
+ else if (elapsed < 86400) {
301
+ const hours = Math.floor(elapsed / 3600);
302
+ return `${hours} hour${hours === 1 ? "" : "s"} ago`;
303
+ }
304
+ else if (elapsed < 2592000) {
305
+ const days = Math.floor(elapsed / 86400);
306
+ return `${days} day${days === 1 ? "" : "s"} ago`;
307
+ }
308
+ else if (elapsed < 31536000) {
309
+ const months = Math.floor(elapsed / 2592000);
310
+ return `${months} month${months === 1 ? "" : "s"} ago`;
311
+ }
312
+ else {
313
+ const years = Math.floor(elapsed / 31536000);
314
+ return `${years} year${years === 1 ? "" : "s"} ago`;
315
+ }
316
+ }
317
+ function activityBy(activity) {
318
+ var _a, _b;
319
+ const name = ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) || ((_b = activity === null || activity === void 0 ? void 0 : activity.user) === null || _b === void 0 ? void 0 : _b.name);
320
+ return name ? `[${activity.id}]\t${name}` : `???`;
321
+ }
322
+ export { activityBy, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, timestampToTimeAgo, };
package/bin/index.js CHANGED
@@ -32,7 +32,7 @@ cli
32
32
  }
33
33
  }));
34
34
  cli
35
- .command("me")
35
+ .command("whoami")
36
36
  .description("Get details of the logged in user")
37
37
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
38
38
  yield Auth.Myself();
@@ -88,7 +88,7 @@ cli
88
88
  .description("Delete entire collections of anime or manga")
89
89
  .option("-a, --anime", "For anime list of authenticated user", false)
90
90
  .option("-m, --manga", "For manga list of authenticated user", false)
91
- .option("-ac, --activity", "For activity of authenticated user", false)
91
+ .option("-s, --activity", "For activity of authenticated user", false)
92
92
  .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
93
93
  const selectedOptions = [anime, manga, activity].filter(Boolean).length;
94
94
  if (selectedOptions === 0) {
package/package.json CHANGED
@@ -1,80 +1,80 @@
1
- {
2
- "name": "@irfanshadikrishad/anilist",
3
- "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
- "author": "Irfan Shadik Rishad",
5
- "version": "1.2.0-forbidden.1",
6
- "main": "./bin/index.js",
7
- "type": "module",
8
- "types": "./bin/index.d.ts",
9
- "bin": {
10
- "anilist": "./bin/index.js"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "scripts": {
16
- "build": "rm -rf ./bin && tsc",
17
- "buildw": "rm -rf ./bin && tsc -w",
18
- "format": "prettier . --write",
19
- "format:check": "prettier . --check",
20
- "lint": "eslint ./dist",
21
- "lint:fix": "eslint ./dist --fix",
22
- "all": "npm run lint && npm run lint:fix && npm run format",
23
- "test": "jest ./tests"
24
- },
25
- "keywords": [
26
- "anilist",
27
- "CLI",
28
- "anime",
29
- "manga",
30
- "anime list",
31
- "manga list",
32
- "anime tracker",
33
- "manga tracker",
34
- "anilist API",
35
- "anime progress",
36
- "manga progress",
37
- "media list",
38
- "export anime",
39
- "import anime",
40
- "export manga",
41
- "import manga",
42
- "status tracker",
43
- "watchlist",
44
- "reading list",
45
- "graphql"
46
- ],
47
- "repository": {
48
- "type": "git",
49
- "url": "https://github.com/irfanshadikrishad/anilist"
50
- },
51
- "homepage": "https://github.com/irfanshadikrishad/anilist",
52
- "bugs": {
53
- "url": "https://github.com/irfanshadikrishad/anilist/issues"
54
- },
55
- "license": "MPL-2.0",
56
- "devDependencies": {
57
- "@eslint/js": "^9.17.0",
58
- "@types/jest": "^29.5.14",
59
- "@types/json2csv": "^5.0.7",
60
- "@types/node": "^22.10.3",
61
- "eslint": "^9.17.0",
62
- "globals": "^15.14.0",
63
- "jest": "^29.7.0",
64
- "prettier": "^3.4.2",
65
- "prettier-plugin-organize-imports": "^4.1.0",
66
- "ts-jest": "^29.2.5",
67
- "ts-node": "^10.9.2",
68
- "typescript": "^5.7.2",
69
- "@babel/preset-env": "^7.26.0",
70
- "@typescript-eslint/eslint-plugin": "^8.19.0"
71
- },
72
- "dependencies": {
73
- "commander": "^12.1.0",
74
- "fast-xml-parser": "^4.5.1",
75
- "inquirer": "^12.3.0",
76
- "json2csv": "^6.0.0-alpha.2",
77
- "node-fetch": "^3.3.2",
78
- "open": "^10.1.0"
79
- }
80
- }
1
+ {
2
+ "name": "@irfanshadikrishad/anilist",
3
+ "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
+ "author": "Irfan Shadik Rishad",
5
+ "version": "1.2.3-forbidden.1",
6
+ "main": "./bin/index.js",
7
+ "type": "module",
8
+ "types": "./bin/index.d.ts",
9
+ "bin": {
10
+ "anilist": "./bin/index.js"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "build": "rm -rf ./bin && tsc",
17
+ "buildw": "rm -rf ./bin && tsc -w",
18
+ "format": "prettier . --write",
19
+ "format:check": "prettier . --check",
20
+ "lint": "eslint ./dist",
21
+ "lint:fix": "eslint ./dist --fix",
22
+ "all": "npm run lint && npm run lint:fix && npm run format && npm test",
23
+ "test": "jest ./tests"
24
+ },
25
+ "keywords": [
26
+ "anilist",
27
+ "CLI",
28
+ "anime",
29
+ "manga",
30
+ "anime list",
31
+ "manga list",
32
+ "anime tracker",
33
+ "manga tracker",
34
+ "anilist API",
35
+ "anime progress",
36
+ "manga progress",
37
+ "media list",
38
+ "export anime",
39
+ "import anime",
40
+ "export manga",
41
+ "import manga",
42
+ "status tracker",
43
+ "watchlist",
44
+ "reading list",
45
+ "graphql"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/irfanshadikrishad/anilist"
50
+ },
51
+ "homepage": "https://github.com/irfanshadikrishad/anilist",
52
+ "bugs": {
53
+ "url": "https://github.com/irfanshadikrishad/anilist/issues"
54
+ },
55
+ "license": "MPL-2.0",
56
+ "devDependencies": {
57
+ "@eslint/js": "^9.17.0",
58
+ "@types/jest": "^29.5.14",
59
+ "@types/json2csv": "^5.0.7",
60
+ "@types/node": "^22.10.5",
61
+ "eslint": "^9.17.0",
62
+ "globals": "^15.14.0",
63
+ "jest": "^29.7.0",
64
+ "prettier": "^3.4.2",
65
+ "prettier-plugin-organize-imports": "^4.1.0",
66
+ "ts-jest": "^29.2.5",
67
+ "ts-node": "^10.9.2",
68
+ "typescript": "^5.7.2",
69
+ "@babel/preset-env": "^7.26.0",
70
+ "@typescript-eslint/eslint-plugin": "^8.19.1"
71
+ },
72
+ "dependencies": {
73
+ "commander": "^13.0.0",
74
+ "fast-xml-parser": "^4.5.1",
75
+ "inquirer": "^12.3.0",
76
+ "json2csv": "^6.0.0-alpha.2",
77
+ "node-fetch": "^3.3.2",
78
+ "open": "^10.1.0"
79
+ }
80
+ }
Binary file