@upstash/ratelimit 0.4.3 → 0.4.5-canary.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.
Files changed (93) hide show
  1. package/.github/actions/redis/action.yaml +58 -0
  2. package/.github/img/dashboard.png +0 -0
  3. package/.github/workflows/release.yml +46 -0
  4. package/.github/workflows/stale.yaml +31 -0
  5. package/.github/workflows/tests.yaml +79 -0
  6. package/README.md +10 -3
  7. package/biome.json +37 -0
  8. package/bun.lockb +0 -0
  9. package/cmd/set-version.js +14 -0
  10. package/examples/cloudflare-workers/package.json +18 -0
  11. package/examples/cloudflare-workers/src/index.ts +35 -0
  12. package/examples/cloudflare-workers/tsconfig.json +105 -0
  13. package/examples/cloudflare-workers/wrangler.toml +3 -0
  14. package/examples/nextjs/LICENSE +21 -0
  15. package/examples/nextjs/README.md +17 -0
  16. package/examples/nextjs/components/Breadcrumb.tsx +67 -0
  17. package/examples/nextjs/components/Header.tsx +18 -0
  18. package/examples/nextjs/components/ReadBlogPost.tsx +9 -0
  19. package/examples/nextjs/components/StarButton.tsx +27 -0
  20. package/examples/nextjs/middleware.ts +35 -0
  21. package/examples/nextjs/next-env.d.ts +5 -0
  22. package/examples/nextjs/package.json +27 -0
  23. package/examples/nextjs/pages/_app.tsx +47 -0
  24. package/examples/nextjs/pages/api/blocked.ts +6 -0
  25. package/examples/nextjs/pages/api/hello.ts +5 -0
  26. package/examples/nextjs/pages/index.tsx +62 -0
  27. package/examples/nextjs/postcss.config.js +6 -0
  28. package/examples/nextjs/public/favicon.ico +0 -0
  29. package/examples/nextjs/public/github.svg +11 -0
  30. package/examples/nextjs/public/upstash.svg +27 -0
  31. package/examples/nextjs/styles/globals.css +76 -0
  32. package/examples/nextjs/tailwind.config.js +19 -0
  33. package/examples/nextjs/tsconfig.json +21 -0
  34. package/examples/nextjs13/README.md +38 -0
  35. package/examples/nextjs13/app/favicon.ico +0 -0
  36. package/examples/nextjs13/app/globals.css +107 -0
  37. package/examples/nextjs13/app/layout.tsx +18 -0
  38. package/examples/nextjs13/app/page.module.css +271 -0
  39. package/examples/nextjs13/app/route.tsx +14 -0
  40. package/examples/nextjs13/next.config.js +8 -0
  41. package/examples/nextjs13/package.json +22 -0
  42. package/examples/nextjs13/public/next.svg +1 -0
  43. package/examples/nextjs13/public/thirteen.svg +1 -0
  44. package/examples/nextjs13/public/vercel.svg +1 -0
  45. package/examples/nextjs13/tsconfig.json +28 -0
  46. package/examples/remix/.env.example +2 -0
  47. package/examples/remix/.eslintrc.js +4 -0
  48. package/examples/remix/README.md +59 -0
  49. package/examples/remix/app/root.tsx +25 -0
  50. package/examples/remix/app/routes/index.tsx +47 -0
  51. package/examples/remix/package.json +32 -0
  52. package/examples/remix/public/favicon.ico +0 -0
  53. package/examples/remix/remix.config.js +12 -0
  54. package/examples/remix/remix.env.d.ts +2 -0
  55. package/examples/remix/server.js +4 -0
  56. package/examples/remix/tsconfig.json +22 -0
  57. package/examples/with-vercel-kv/README.md +51 -0
  58. package/examples/with-vercel-kv/app/favicon.ico +0 -0
  59. package/examples/with-vercel-kv/app/globals.css +27 -0
  60. package/examples/with-vercel-kv/app/layout.tsx +21 -0
  61. package/examples/with-vercel-kv/app/page.tsx +71 -0
  62. package/examples/with-vercel-kv/next.config.js +8 -0
  63. package/examples/with-vercel-kv/package.json +25 -0
  64. package/examples/with-vercel-kv/postcss.config.js +6 -0
  65. package/examples/with-vercel-kv/public/next.svg +1 -0
  66. package/examples/with-vercel-kv/public/vercel.svg +1 -0
  67. package/examples/with-vercel-kv/tailwind.config.js +17 -0
  68. package/examples/with-vercel-kv/tsconfig.json +28 -0
  69. package/package.json +12 -33
  70. package/src/analytics.test.ts +23 -0
  71. package/src/analytics.ts +92 -0
  72. package/src/blockUntilReady.test.ts +56 -0
  73. package/src/cache.test.ts +41 -0
  74. package/src/cache.ts +43 -0
  75. package/src/duration.test.ts +23 -0
  76. package/src/duration.ts +30 -0
  77. package/src/index.ts +17 -0
  78. package/src/multi.ts +365 -0
  79. package/src/ratelimit.test.ts +155 -0
  80. package/src/ratelimit.ts +238 -0
  81. package/src/single.ts +487 -0
  82. package/src/test_utils.ts +65 -0
  83. package/src/tools/seed.ts +37 -0
  84. package/src/types.ts +78 -0
  85. package/src/version.ts +1 -0
  86. package/tsconfig.json +103 -0
  87. package/tsup.config.js +11 -0
  88. package/turbo.json +16 -0
  89. package/dist/index.d.ts +0 -558
  90. package/dist/index.js +0 -828
  91. package/dist/index.js.map +0 -1
  92. package/dist/index.mjs +0 -799
  93. package/dist/index.mjs.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,558 +0,0 @@
1
- /**
2
- * EphemeralCache is used to block certain identifiers right away in case they have already exceedd the ratelimit.
3
- */
4
- interface EphemeralCache {
5
- isBlocked: (identifier: string) => {
6
- blocked: boolean;
7
- reset: number;
8
- };
9
- blockUntil: (identifier: string, reset: number) => void;
10
- set: (key: string, value: number) => void;
11
- get: (key: string) => number | null;
12
- incr: (key: string) => number;
13
- }
14
- type RegionContext = {
15
- redis: Redis;
16
- cache?: EphemeralCache;
17
- };
18
- type MultiRegionContext = {
19
- redis: Redis[];
20
- cache?: EphemeralCache;
21
- };
22
- type Context = RegionContext | MultiRegionContext;
23
- type RatelimitResponse = {
24
- /**
25
- * Whether the request may pass(true) or exceeded the limit(false)
26
- */
27
- success: boolean;
28
- /**
29
- * Maximum number of requests allowed within a window.
30
- */
31
- limit: number;
32
- /**
33
- * How many requests the user has left within the current window.
34
- */
35
- remaining: number;
36
- /**
37
- * Unix timestamp in milliseconds when the limits are reset.
38
- */
39
- reset: number;
40
- /**
41
- * For the MultiRegion setup we do some synchronizing in the background, after returning the current limit.
42
- * In most case you can simply ignore this.
43
- *
44
- * On Vercel Edge or Cloudflare workers, you need to explicitely handle the pending Promise like this:
45
- *
46
- * **Vercel Edge:**
47
- * https://nextjs.org/docs/api-reference/next/server#nextfetchevent
48
- *
49
- * ```ts
50
- * const { pending } = await ratelimit.limit("id")
51
- * event.waitUntil(pending)
52
- * ```
53
- *
54
- * **Cloudflare Worker:**
55
- * https://developers.cloudflare.com/workers/runtime-apis/fetch-event/#syntax-module-worker
56
- *
57
- * ```ts
58
- * const { pending } = await ratelimit.limit("id")
59
- * context.waitUntil(pending)
60
- * ```
61
- */
62
- pending: Promise<unknown>;
63
- };
64
- type Algorithm<TContext> = (ctx: TContext, identifier: string, opts?: {
65
- cache?: EphemeralCache;
66
- }) => Promise<RatelimitResponse>;
67
- /**
68
- * This is all we need from the redis sdk.
69
- */
70
- interface Redis {
71
- sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
72
- eval: <TArgs extends unknown[], TData = unknown>(...args: [script: string, keys: string[], args: TArgs]) => Promise<TData>;
73
- }
74
-
75
- type Geo = {
76
- country?: string;
77
- city?: string;
78
- region?: string;
79
- ip?: string;
80
- };
81
- type Event = Geo & {
82
- identifier: string;
83
- time: number;
84
- success: boolean;
85
- };
86
- type AnalyticsConfig = {
87
- redis: Redis;
88
- prefix?: string;
89
- };
90
- /**
91
- * The Analytics package is experimental and can change at any time.
92
- */
93
- declare class Analytics {
94
- private readonly analytics;
95
- private readonly table;
96
- constructor(config: AnalyticsConfig);
97
- /**
98
- * Try to extract the geo information from the request
99
- *
100
- * This handles Vercel's `req.geo` and and Cloudflare's `request.cf` properties
101
- * @param req
102
- * @returns
103
- */
104
- extractGeo(req: {
105
- geo?: Geo;
106
- cf?: Geo;
107
- }): Geo;
108
- record(event: Event): Promise<void>;
109
- series<TFilter extends keyof Omit<Event, "time">>(filter: TFilter, cutoff: number): Promise<({
110
- time: number;
111
- } & Record<string, number>)[]>;
112
- getUsage(cutoff?: number): Promise<Record<string, {
113
- success: number;
114
- blocked: number;
115
- }>>;
116
- }
117
-
118
- type Unit = "ms" | "s" | "m" | "h" | "d";
119
- type Duration = `${number} ${Unit}` | `${number}${Unit}`;
120
-
121
- type RatelimitConfig<TContext> = {
122
- /**
123
- * The ratelimiter function to use.
124
- *
125
- * Choose one of the predefined ones or implement your own.
126
- * Available algorithms are exposed via static methods:
127
- * - Ratelimiter.fixedWindow
128
- * - Ratelimiter.slidingLogs
129
- * - Ratelimiter.slidingWindow
130
- * - Ratelimiter.tokenBucket
131
- */
132
- limiter: Algorithm<TContext>;
133
- ctx: TContext;
134
- /**
135
- * All keys in redis are prefixed with this.
136
- *
137
- * @default `@upstash/ratelimit`
138
- */
139
- prefix?: string;
140
- /**
141
- * If enabled, the ratelimiter will keep a global cache of identifiers, that have
142
- * exhausted their ratelimit. In serverless environments this is only possible if
143
- * you create the ratelimiter instance outside of your handler function. While the
144
- * function is still hot, the ratelimiter can block requests without having to
145
- * request data from redis, thus saving time and money.
146
- *
147
- * Whenever an identifier has exceeded its limit, the ratelimiter will add it to an
148
- * internal list together with its reset timestamp. If the same identifier makes a
149
- * new request before it is reset, we can immediately reject it.
150
- *
151
- * Set to `false` to disable.
152
- *
153
- * If left undefined, a map is created automatically, but it can only work
154
- * if the map or the ratelimit instance is created outside your serverless function handler.
155
- */
156
- ephemeralCache?: Map<string, number> | false;
157
- /**
158
- * If set, the ratelimiter will allow requests to pass after this many milliseconds.
159
- *
160
- * Use this if you want to allow requests in case of network problems
161
- *
162
- * @default 5000
163
- */
164
- timeout?: number;
165
- /**
166
- * If enabled, the ratelimiter will store analytics data in redis, which you can check out at
167
- * https://upstash.com/ratelimit
168
- *
169
- * @default false
170
- */
171
- analytics?: boolean;
172
- };
173
- /**
174
- * Ratelimiter using serverless redis from https://upstash.com/
175
- *
176
- * @example
177
- * ```ts
178
- * const { limit } = new Ratelimit({
179
- * redis: Redis.fromEnv(),
180
- * limiter: Ratelimit.slidingWindow(
181
- * 10, // Allow 10 requests per window of 30 minutes
182
- * "30 m", // interval of 30 minutes
183
- * ),
184
- * })
185
- *
186
- * ```
187
- */
188
- declare abstract class Ratelimit<TContext extends Context> {
189
- protected readonly limiter: Algorithm<TContext>;
190
- protected readonly ctx: TContext;
191
- protected readonly prefix: string;
192
- protected readonly timeout: number;
193
- protected readonly analytics?: Analytics;
194
- constructor(config: RatelimitConfig<TContext>);
195
- /**
196
- * Determine if a request should pass or be rejected based on the identifier and previously chosen ratelimit.
197
- *
198
- * Use this if you want to reject all requests that you can not handle right now.
199
- *
200
- * @example
201
- * ```ts
202
- * const ratelimit = new Ratelimit({
203
- * redis: Redis.fromEnv(),
204
- * limiter: Ratelimit.slidingWindow(10, "10 s")
205
- * })
206
- *
207
- * const { success } = await ratelimit.limit(id)
208
- * if (!success){
209
- * return "Nope"
210
- * }
211
- * return "Yes"
212
- * ```
213
- */
214
- limit: (identifier: string, req?: {
215
- geo?: Geo;
216
- }) => Promise<RatelimitResponse>;
217
- /**
218
- * Block until the request may pass or timeout is reached.
219
- *
220
- * This method returns a promise that resolves as soon as the request may be processed
221
- * or after the timeoue has been reached.
222
- *
223
- * Use this if you want to delay the request until it is ready to get processed.
224
- *
225
- * @example
226
- * ```ts
227
- * const ratelimit = new Ratelimit({
228
- * redis: Redis.fromEnv(),
229
- * limiter: Ratelimit.slidingWindow(10, "10 s")
230
- * })
231
- *
232
- * const { success } = await ratelimit.blockUntilReady(id, 60_000)
233
- * if (!success){
234
- * return "Nope"
235
- * }
236
- * return "Yes"
237
- * ```
238
- */
239
- blockUntilReady: (identifier: string, timeout: number) => Promise<RatelimitResponse>;
240
- }
241
-
242
- type MultiRegionRatelimitConfig = {
243
- /**
244
- * Instances of `@upstash/redis`
245
- * @see https://github.com/upstash/upstash-redis#quick-start
246
- */
247
- redis: Redis[];
248
- /**
249
- * The ratelimiter function to use.
250
- *
251
- * Choose one of the predefined ones or implement your own.
252
- * Available algorithms are exposed via static methods:
253
- * - MultiRegionRatelimit.fixedWindow
254
- */
255
- limiter: Algorithm<MultiRegionContext>;
256
- /**
257
- * All keys in redis are prefixed with this.
258
- *
259
- * @default `@upstash/ratelimit`
260
- */
261
- prefix?: string;
262
- /**
263
- * If enabled, the ratelimiter will keep a global cache of identifiers, that have
264
- * exhausted their ratelimit. In serverless environments this is only possible if
265
- * you create the ratelimiter instance outside of your handler function. While the
266
- * function is still hot, the ratelimiter can block requests without having to
267
- * request data from redis, thus saving time and money.
268
- *
269
- * Whenever an identifier has exceeded its limit, the ratelimiter will add it to an
270
- * internal list together with its reset timestamp. If the same identifier makes a
271
- * new request before it is reset, we can immediately reject it.
272
- *
273
- * Set to `false` to disable.
274
- *
275
- * If left undefined, a map is created automatically, but it can only work
276
- * if the map or th ratelimit instance is created outside your serverless function handler.
277
- */
278
- ephemeralCache?: Map<string, number> | false;
279
- /**
280
- * If set, the ratelimiter will allow requests to pass after this many milliseconds.
281
- *
282
- * Use this if you want to allow requests in case of network problems
283
- */
284
- timeout?: number;
285
- /**
286
- * If enabled, the ratelimiter will store analytics data in redis, which you can check out at
287
- * https://console.upstash.com/ratelimit
288
- *
289
- * @default true
290
- */
291
- analytics?: boolean;
292
- };
293
- /**
294
- * Ratelimiter using serverless redis from https://upstash.com/
295
- *
296
- * @example
297
- * ```ts
298
- * const { limit } = new MultiRegionRatelimit({
299
- * redis: Redis.fromEnv(),
300
- * limiter: MultiRegionRatelimit.fixedWindow(
301
- * 10, // Allow 10 requests per window of 30 minutes
302
- * "30 m", // interval of 30 minutes
303
- * )
304
- * })
305
- *
306
- * ```
307
- */
308
- declare class MultiRegionRatelimit extends Ratelimit<MultiRegionContext> {
309
- /**
310
- * Create a new Ratelimit instance by providing a `@upstash/redis` instance and the algorithn of your choice.
311
- */
312
- constructor(config: MultiRegionRatelimitConfig);
313
- /**
314
- * Each requests inside a fixed time increases a counter.
315
- * Once the counter reaches a maxmimum allowed number, all further requests are
316
- * rejected.
317
- *
318
- * **Pro:**
319
- *
320
- * - Newer requests are not starved by old ones.
321
- * - Low storage cost.
322
- *
323
- * **Con:**
324
- *
325
- * A burst of requests near the boundary of a window can result in a very
326
- * high request rate because two windows will be filled with requests quickly.
327
- *
328
- * @param tokens - How many requests a user can make in each time window.
329
- * @param window - A fixed timeframe
330
- */
331
- static fixedWindow(
332
- /**
333
- * How many requests are allowed per window.
334
- */
335
- tokens: number,
336
- /**
337
- * The duration in which `tokens` requests are allowed.
338
- */
339
- window: Duration): Algorithm<MultiRegionContext>;
340
- /**
341
- * Combined approach of `slidingLogs` and `fixedWindow` with lower storage
342
- * costs than `slidingLogs` and improved boundary behavior by calcualting a
343
- * weighted score between two windows.
344
- *
345
- * **Pro:**
346
- *
347
- * Good performance allows this to scale to very high loads.
348
- *
349
- * **Con:**
350
- *
351
- * Nothing major.
352
- *
353
- * @param tokens - How many requests a user can make in each time window.
354
- * @param window - The duration in which the user can max X requests.
355
- */
356
- static slidingWindow(
357
- /**
358
- * How many requests are allowed per window.
359
- */
360
- tokens: number,
361
- /**
362
- * The duration in which `tokens` requests are allowed.
363
- */
364
- window: Duration): Algorithm<MultiRegionContext>;
365
- }
366
-
367
- type RegionRatelimitConfig = {
368
- /**
369
- * Instance of `@upstash/redis`
370
- * @see https://github.com/upstash/upstash-redis#quick-start
371
- */
372
- redis: Redis;
373
- /**
374
- * The ratelimiter function to use.
375
- *
376
- * Choose one of the predefined ones or implement your own.
377
- * Available algorithms are exposed via static methods:
378
- * - Ratelimiter.fixedWindow
379
- * - Ratelimiter.slidingLogs
380
- * - Ratelimiter.slidingWindow
381
- * - Ratelimiter.tokenBucket
382
- */
383
- limiter: Algorithm<RegionContext>;
384
- /**
385
- * All keys in redis are prefixed with this.
386
- *
387
- * @default `@upstash/ratelimit`
388
- */
389
- prefix?: string;
390
- /**
391
- * If enabled, the ratelimiter will keep a global cache of identifiers, that have
392
- * exhausted their ratelimit. In serverless environments this is only possible if
393
- * you create the ratelimiter instance outside of your handler function. While the
394
- * function is still hot, the ratelimiter can block requests without having to
395
- * request data from redis, thus saving time and money.
396
- *
397
- * Whenever an identifier has exceeded its limit, the ratelimiter will add it to an
398
- * internal list together with its reset timestamp. If the same identifier makes a
399
- * new request before it is reset, we can immediately reject it.
400
- *
401
- * Set to `false` to disable.
402
- *
403
- * If left undefined, a map is created automatically, but it can only work
404
- * if the map or the ratelimit instance is created outside your serverless function handler.
405
- */
406
- ephemeralCache?: Map<string, number> | false;
407
- /**
408
- * If set, the ratelimiter will allow requests to pass after this many milliseconds.
409
- *
410
- * Use this if you want to allow requests in case of network problems
411
- */
412
- timeout?: number;
413
- /**
414
- * If enabled, the ratelimiter will store analytics data in redis, which you can check out at
415
- * https://upstash.com/ratelimit
416
- *
417
- * @default true
418
- */
419
- analytics?: boolean;
420
- };
421
- /**
422
- * Ratelimiter using serverless redis from https://upstash.com/
423
- *
424
- * @example
425
- * ```ts
426
- * const { limit } = new Ratelimit({
427
- * redis: Redis.fromEnv(),
428
- * limiter: Ratelimit.slidingWindow(
429
- * "30 m", // interval of 30 minutes
430
- * 10, // Allow 10 requests per window of 30 minutes
431
- * )
432
- * })
433
- *
434
- * ```
435
- */
436
- declare class RegionRatelimit extends Ratelimit<RegionContext> {
437
- /**
438
- * Create a new Ratelimit instance by providing a `@upstash/redis` instance and the algorithn of your choice.
439
- */
440
- constructor(config: RegionRatelimitConfig);
441
- /**
442
- * Each requests inside a fixed time increases a counter.
443
- * Once the counter reaches a maxmimum allowed number, all further requests are
444
- * rejected.
445
- *
446
- * **Pro:**
447
- *
448
- * - Newer requests are not starved by old ones.
449
- * - Low storage cost.
450
- *
451
- * **Con:**
452
- *
453
- * A burst of requests near the boundary of a window can result in a very
454
- * high request rate because two windows will be filled with requests quickly.
455
- *
456
- * @param tokens - How many requests a user can make in each time window.
457
- * @param window - A fixed timeframe
458
- */
459
- static fixedWindow(
460
- /**
461
- * How many requests are allowed per window.
462
- */
463
- tokens: number,
464
- /**
465
- * The duration in which `tokens` requests are allowed.
466
- */
467
- window: Duration): Algorithm<RegionContext>;
468
- /**
469
- * Combined approach of `slidingLogs` and `fixedWindow` with lower storage
470
- * costs than `slidingLogs` and improved boundary behavior by calcualting a
471
- * weighted score between two windows.
472
- *
473
- * **Pro:**
474
- *
475
- * Good performance allows this to scale to very high loads.
476
- *
477
- * **Con:**
478
- *
479
- * Nothing major.
480
- *
481
- * @param tokens - How many requests a user can make in each time window.
482
- * @param window - The duration in which the user can max X requests.
483
- */
484
- static slidingWindow(
485
- /**
486
- * How many requests are allowed per window.
487
- */
488
- tokens: number,
489
- /**
490
- * The duration in which `tokens` requests are allowed.
491
- */
492
- window: Duration): Algorithm<RegionContext>;
493
- /**
494
- * You have a bucket filled with `{maxTokens}` tokens that refills constantly
495
- * at `{refillRate}` per `{interval}`.
496
- * Every request will remove one token from the bucket and if there is no
497
- * token to take, the request is rejected.
498
- *
499
- * **Pro:**
500
- *
501
- * - Bursts of requests are smoothed out and you can process them at a constant
502
- * rate.
503
- * - Allows to set a higher initial burst limit by setting `maxTokens` higher
504
- * than `refillRate`
505
- */
506
- static tokenBucket(
507
- /**
508
- * How many tokens are refilled per `interval`
509
- *
510
- * An interval of `10s` and refillRate of 5 will cause a new token to be added every 2 seconds.
511
- */
512
- refillRate: number,
513
- /**
514
- * The interval for the `refillRate`
515
- */
516
- interval: Duration,
517
- /**
518
- * Maximum number of tokens.
519
- * A newly created bucket starts with this many tokens.
520
- * Useful to allow higher burst limits.
521
- */
522
- maxTokens: number): Algorithm<RegionContext>;
523
- /**
524
- * cachedFixedWindow first uses the local cache to decide if a request may pass and then updates
525
- * it asynchronously.
526
- * This is experimental and not yet recommended for production use.
527
- *
528
- * @experimental
529
- *
530
- * Each requests inside a fixed time increases a counter.
531
- * Once the counter reaches a maxmimum allowed number, all further requests are
532
- * rejected.
533
- *
534
- * **Pro:**
535
- *
536
- * - Newer requests are not starved by old ones.
537
- * - Low storage cost.
538
- *
539
- * **Con:**
540
- *
541
- * A burst of requests near the boundary of a window can result in a very
542
- * high request rate because two windows will be filled with requests quickly.
543
- *
544
- * @param tokens - How many requests a user can make in each time window.
545
- * @param window - A fixed timeframe
546
- */
547
- static cachedFixedWindow(
548
- /**
549
- * How many requests are allowed per window.
550
- */
551
- tokens: number,
552
- /**
553
- * The duration in which `tokens` requests are allowed.
554
- */
555
- window: Duration): Algorithm<RegionContext>;
556
- }
557
-
558
- export { Algorithm, Analytics, AnalyticsConfig, MultiRegionRatelimit, MultiRegionRatelimitConfig, RegionRatelimit as Ratelimit, RegionRatelimitConfig as RatelimitConfig };