express-rate-limit 6.0.0 → 6.0.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/changelog.md CHANGED
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
- ## 6.0.0
9
+ ## [6.0.0](https://github.com/nfriedly/express-rate-limit/releases/v6.0.0)
10
10
 
11
11
  ### Added
12
12
 
@@ -24,6 +24,7 @@ and this project adheres to
24
24
  - Rename the `headers` option to `legacyHeaders`.
25
25
  - `Retry-After` header is now sent if either `legacyHeaders` or
26
26
  `standardHeaders` is set.
27
+ - Allow `keyGenerator` to be an async function/return a promise.
27
28
  - Change the way custom stores are defined.
28
29
  - Add the `init` method for stores to set themselves up using options passed
29
30
  to the middleware.
@@ -32,7 +33,8 @@ and this project adheres to
32
33
  return a promise.
33
34
  - Old stores will automatically be promisified and used.
34
35
  - The package can now only be used with NodeJS version 12.9.0 or greater.
35
- - The `onLimitReached` configuration option is now deprecated. Replace it with a custom `handler` that checks the number of hits.
36
+ - The `onLimitReached` configuration option is now deprecated. Replace it with a
37
+ custom `handler` that checks the number of hits.
36
38
 
37
39
  ### Removed
38
40
 
@@ -0,0 +1,12 @@
1
+ {
2
+ "types": "./index.d.ts",
3
+ "exports": {
4
+ ".": "./index.js"
5
+ },
6
+ "engines": {
7
+ "node": ">= 12.9.0"
8
+ },
9
+ "peerDependencies": {
10
+ "express": "^4"
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "type": "module",
3
+ "types": "./index.d.ts",
4
+ "exports": {
5
+ ".": "./index.js"
6
+ },
7
+ "engines": {
8
+ "node": ">= 12.9.0"
9
+ },
10
+ "peerDependencies": {
11
+ "express": "^4"
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
5
5
  "author": {
6
6
  "name": "Nathan Friedly",
@@ -28,33 +28,17 @@
28
28
  "attack"
29
29
  ],
30
30
  "type": "module",
31
- "module": "dist/esm/index.js",
32
- "main": "dist/cjs/index.js",
31
+ "types": "./dist/esm/index.d.ts",
33
32
  "exports": {
34
33
  ".": {
35
34
  "import": "./dist/esm/index.js",
36
35
  "require": "./dist/cjs/index.js"
37
- },
38
- "./memory-store": {
39
- "import": "./dist/esm/memory-store.js",
40
- "require": "./dist/cjs/memory-store.js"
41
- }
42
- },
43
- "typesVersions": {
44
- "*": {
45
- ".": [
46
- "./dist/esm/index.d.ts"
47
- ],
48
- "./memory-store": [
49
- "./dist/esm/memory-store.d.ts"
50
- ]
51
36
  }
52
37
  },
53
38
  "files": [
54
39
  "dist/",
55
40
  "tsconfig.json",
56
41
  "package.json",
57
- "package-lock.json",
58
42
  "readme.md",
59
43
  "license.md",
60
44
  "changelog.md"
@@ -64,8 +48,8 @@
64
48
  },
65
49
  "scripts": {
66
50
  "clean": "del-cli dist/ coverage/ *.log *.tmp *.bak *.tgz",
67
- "build:cjs": "tsc --project config/typescript/cjs.json",
68
- "build:esm": "tsc --project config/typescript/esm.json",
51
+ "build:cjs": "tsc --project config/typescript/cjs.json && cpy --rename package.json config/node/cjs.json dist/cjs/",
52
+ "build:esm": "tsc --project config/typescript/esm.json && cpy --rename package.json config/node/esm.json dist/esm/",
69
53
  "build": "run-p build:*",
70
54
  "compile": "run-s clean build",
71
55
  "lint": "xo",
@@ -85,6 +69,7 @@
85
69
  "@types/jest": "^27.0.3",
86
70
  "@types/node": "^16.11.17",
87
71
  "@types/supertest": "^2.0.11",
72
+ "cpy-cli": "^3.1.1",
88
73
  "cross-env": "^7.0.3",
89
74
  "del-cli": "^4.0.1",
90
75
  "express": "^4.17.1",
package/readme.md CHANGED
@@ -275,7 +275,7 @@ const keyGenerator = (request /*, response*/) => request.ip
275
275
 
276
276
  The function to handle requests once the max limit is exceeded. It receives the
277
277
  `request` and the `response` objects. The `next` param is available if you need
278
- to pass to the next middleware/route. Finally, the `optionsUsed` param has all
278
+ to pass to the next middleware/route. Finally, the `options` param has all
279
279
  of the options that originally passed in when creating the current limiter and
280
280
  the default values for other options.
281
281
 
@@ -285,7 +285,7 @@ requests and, if the store provides it, a `resetTime` Date object.
285
285
  Defaults to:
286
286
 
287
287
  ```ts
288
- const handler = (request, response, next, optionsUsed) => {
288
+ const handler = (request, response, next, options) => {
289
289
  response.status(options.statusCode).send(options.message)
290
290
  }
291
291
  ```