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/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 ?? 86400;
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.0" ;
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 message = json.errors?.[0]?.message ?? `AniList API error (HTTP ${res.status})`;
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);