ani-client 2.3.0 → 2.5.0

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.
@@ -103,6 +103,8 @@ interface AniListHooks {
103
103
  onCacheHit?: (key: string) => void;
104
104
  /** Called when the rate limiter enforces a wait (429 received). */
105
105
  onRateLimit?: (retryAfterMs: number) => void;
106
+ /** Called when the remaining rate limit drops to critically low levels (<= 15% of limit). */
107
+ onRateLimitAlert?: (remaining: number, resetInSeconds: number) => void;
106
108
  /** Called when a request is retried (429 or network error). */
107
109
  onRetry?: (attempt: number, reason: string, delayMs: number) => void;
108
110
  /** Called when a request completes. */
@@ -138,6 +140,15 @@ interface Logger {
138
140
  warn(message: string, ...args: unknown[]): void;
139
141
  error(message: string, ...args: unknown[]): void;
140
142
  }
143
+ /** Auto-batching (DataLoader) configuration options. */
144
+ interface BatchingOptions {
145
+ /** Enable or disable transparent auto-batching (default: true) */
146
+ enabled?: boolean;
147
+ /** Maximum time to wait for additional IDs before dispatching, in ms (default: 50) */
148
+ windowMs?: number;
149
+ /** Maximum number of IDs per batch. Flushes immediately when reached (default: 50) */
150
+ maxBatchSize?: number;
151
+ }
141
152
  interface AniListClientOptions {
142
153
  /** Optional AniList OAuth token for authenticated requests */
143
154
  token?: string;
@@ -149,6 +160,8 @@ interface AniListClientOptions {
149
160
  cacheAdapter?: CacheAdapter;
150
161
  /** Rate limiter configuration (enabled by default, 25 req/min) */
151
162
  rateLimit?: RateLimitOptions;
163
+ /** Auto-batching configuration (enabled by default, 50ms window) */
164
+ batching?: BatchingOptions;
152
165
  /** Event hooks for logging, debugging, and monitoring */
153
166
  hooks?: AniListHooks;
154
167
  /** Optional AbortSignal to cancel all requests made by this client */
@@ -103,6 +103,8 @@ interface AniListHooks {
103
103
  onCacheHit?: (key: string) => void;
104
104
  /** Called when the rate limiter enforces a wait (429 received). */
105
105
  onRateLimit?: (retryAfterMs: number) => void;
106
+ /** Called when the remaining rate limit drops to critically low levels (<= 15% of limit). */
107
+ onRateLimitAlert?: (remaining: number, resetInSeconds: number) => void;
106
108
  /** Called when a request is retried (429 or network error). */
107
109
  onRetry?: (attempt: number, reason: string, delayMs: number) => void;
108
110
  /** Called when a request completes. */
@@ -138,6 +140,15 @@ interface Logger {
138
140
  warn(message: string, ...args: unknown[]): void;
139
141
  error(message: string, ...args: unknown[]): void;
140
142
  }
143
+ /** Auto-batching (DataLoader) configuration options. */
144
+ interface BatchingOptions {
145
+ /** Enable or disable transparent auto-batching (default: true) */
146
+ enabled?: boolean;
147
+ /** Maximum time to wait for additional IDs before dispatching, in ms (default: 50) */
148
+ windowMs?: number;
149
+ /** Maximum number of IDs per batch. Flushes immediately when reached (default: 50) */
150
+ maxBatchSize?: number;
151
+ }
141
152
  interface AniListClientOptions {
142
153
  /** Optional AniList OAuth token for authenticated requests */
143
154
  token?: string;
@@ -149,6 +160,8 @@ interface AniListClientOptions {
149
160
  cacheAdapter?: CacheAdapter;
150
161
  /** Rate limiter configuration (enabled by default, 25 req/min) */
151
162
  rateLimit?: RateLimitOptions;
163
+ /** Auto-batching configuration (enabled by default, 50ms window) */
164
+ batching?: BatchingOptions;
152
165
  /** Event hooks for logging, debugging, and monitoring */
153
166
  hooks?: AniListHooks;
154
167
  /** Optional AbortSignal to cancel all requests made by this client */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ani-client",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "A simple and typed client to fetch anime, manga, characters and user data from AniList",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "typecheck": "tsc --noEmit",
35
35
  "prepublishOnly": "pnpm run build",
36
36
  "docs:dev": "vitepress dev docs",
37
- "docs:build": "vitepress build docs",
37
+ "docs:build": "pnpm run build && vitepress build docs",
38
38
  "docs:preview": "vitepress preview docs"
39
39
  },
40
40
  "keywords": [
@@ -60,16 +60,17 @@
60
60
  "url": "https://github.com/gonzyui/ani-client/issues"
61
61
  },
62
62
  "devDependencies": {
63
- "@biomejs/biome": "^2.4.13",
64
- "@types/node": "^25.6.0",
63
+ "@biomejs/biome": "^2.5.0",
64
+ "@types/node": "^25.9.3",
65
65
  "@vercel/analytics": "^2.0.1",
66
- "@vitest/coverage-v8": "^4.1.5",
66
+ "@vitest/coverage-v8": "^4.1.8",
67
+ "ani-client": "^2.4.0",
67
68
  "tsup": "^8.5.1",
68
- "tsx": "^4.21.0",
69
- "typescript": "^5.9.3",
69
+ "tsx": "^4.22.4",
70
+ "typescript": "^6.0.3",
70
71
  "vitepress": "^1.6.4",
71
- "vitest": "^4.1.5",
72
- "vue": "^3.5.33"
72
+ "vitest": "^4.1.8",
73
+ "vue": "^3.5.38"
73
74
  },
74
75
  "packageManager": "pnpm@11.5.1"
75
76
  }