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.
- package/README.md +6 -1
- package/dist/cache/redis.d.mts +1 -1
- package/dist/cache/redis.d.ts +1 -1
- package/dist/index.d.mts +75 -4
- package/dist/index.d.ts +75 -4
- package/dist/index.js +183 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -23
- package/dist/index.mjs.map +1 -1
- package/dist/{redis-UeRs8nqC.d.mts → redis-ClB2nNrs.d.mts} +13 -0
- package/dist/{redis-UeRs8nqC.d.ts → redis-ClB2nNrs.d.ts} +13 -0
- package/package.json +10 -9
|
@@ -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
|
+
"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.
|
|
64
|
-
"@types/node": "^25.
|
|
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.
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
67
|
+
"ani-client": "^2.4.0",
|
|
67
68
|
"tsup": "^8.5.1",
|
|
68
|
-
"tsx": "^4.
|
|
69
|
-
"typescript": "^
|
|
69
|
+
"tsx": "^4.22.4",
|
|
70
|
+
"typescript": "^6.0.3",
|
|
70
71
|
"vitepress": "^1.6.4",
|
|
71
|
-
"vitest": "^4.1.
|
|
72
|
-
"vue": "^3.5.
|
|
72
|
+
"vitest": "^4.1.8",
|
|
73
|
+
"vue": "^3.5.38"
|
|
73
74
|
},
|
|
74
75
|
"packageManager": "pnpm@11.5.1"
|
|
75
76
|
}
|