axios-rate-limit 1.3.1 → 1.3.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "axios-rate-limit",
3
3
  "description": "Rate limit for axios.",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "license": "MIT",
6
6
  "bugs": {
7
7
  "url": "https://github.com/aishek/axios-rate-limit/issues"
@@ -1,9 +1,9 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
 
3
3
  export interface RateLimitedAxiosInstance extends AxiosInstance {
4
- getMaxRPS(): number,
5
- setMaxRPS(rps:number): void,
6
- setRateLimitOptions(options: rateLimitOptions): void,
4
+ getMaxRPS: () => number,
5
+ setMaxRPS: (rps: number) => void,
6
+ setRateLimitOptions: (options: rateLimitOptions) => void,
7
7
  // enable(axios: any): void,
8
8
  // handleRequest(request:any):any,
9
9
  // handleResponse(response: any): any,
@@ -12,7 +12,11 @@ export interface RateLimitedAxiosInstance extends AxiosInstance {
12
12
  // shift():any
13
13
  }
14
14
 
15
- type rateLimitOptions = { maxRequests?: number, perMilliseconds?: number, maxRPS?:number };
15
+ export type rateLimitOptions = {
16
+ maxRequests?: number,
17
+ perMilliseconds?: number,
18
+ maxRPS?: number
19
+ };
16
20
 
17
21
  /**
18
22
  * Apply rate limit to axios instance.
@@ -33,7 +37,7 @@ type rateLimitOptions = { maxRequests?: number, perMilliseconds?: number, maxRPS
33
37
  * http.getMaxRPS() // 3
34
38
  * http.setRateLimitOptions({ maxRequests: 6, perMilliseconds: 150 }) // same options as constructor
35
39
  *
36
- * @param {Object} axios axios instance
40
+ * @param {Object} axiosInstance axios instance
37
41
  * @param {Object} options options for rate limit, available for live update
38
42
  * @param {Number} options.maxRequests max requests to perform concurrently in given amount of time.
39
43
  * @param {Number} options.perMilliseconds amount of time to limit concurrent requests.