ani-client 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/dist/cache/redis.d.mts +1 -1
- package/dist/cache/redis.d.ts +1 -1
- package/dist/cache/redis.js +1 -1
- package/dist/cache/redis.js.map +1 -1
- package/dist/cache/redis.mjs +1 -1
- package/dist/cache/redis.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{redis-AFbnh0Xa.d.mts → redis-UeRs8nqC.d.mts} +1 -1
- package/dist/{redis-AFbnh0Xa.d.ts → redis-UeRs8nqC.d.ts} +1 -1
- package/package.json +3 -13
package/dist/index.mjs
CHANGED
|
@@ -483,7 +483,7 @@ var RedisCache = class {
|
|
|
483
483
|
constructor(options) {
|
|
484
484
|
this.client = options.client;
|
|
485
485
|
this.prefix = options.prefix ?? "ani:";
|
|
486
|
-
this.ttl = options.ttl
|
|
486
|
+
this.ttl = options.ttl !== void 0 ? Math.floor(options.ttl / 1e3) : 86400;
|
|
487
487
|
}
|
|
488
488
|
prefixedKey(key) {
|
|
489
489
|
return `${this.prefix}${key}`;
|
|
@@ -2539,7 +2539,7 @@ function mapFavorites(fav) {
|
|
|
2539
2539
|
|
|
2540
2540
|
// src/client/index.ts
|
|
2541
2541
|
var DEFAULT_API_URL = "https://graphql.anilist.co";
|
|
2542
|
-
var LIB_VERSION = "2.2.
|
|
2542
|
+
var LIB_VERSION = "2.2.1" ;
|
|
2543
2543
|
var AniListClient = class {
|
|
2544
2544
|
apiUrl;
|
|
2545
2545
|
headers;
|
|
@@ -2652,7 +2652,8 @@ var AniListClient = class {
|
|
|
2652
2652
|
throw error;
|
|
2653
2653
|
}
|
|
2654
2654
|
if (!res.ok || json.errors) {
|
|
2655
|
-
const
|
|
2655
|
+
const msgs = (json.errors || []).map((e) => e.message).filter(Boolean);
|
|
2656
|
+
const message = msgs.length > 0 ? msgs.join(" | ") : `AniList API error (HTTP ${res.status})`;
|
|
2656
2657
|
const error = new AniListError(message, res.status, json.errors ?? []);
|
|
2657
2658
|
this.logger?.error("Request failed", { error: error.message, status: error.status });
|
|
2658
2659
|
this.hooks.onError?.(error, query, variables);
|