express-rate-limit 8.2.1 → 8.3.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/dist/index.cjs +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +14 -14
package/dist/index.cjs
CHANGED
|
@@ -31,8 +31,13 @@ module.exports = __toCommonJS(index_exports);
|
|
|
31
31
|
var import_node_net = require("node:net");
|
|
32
32
|
var import_ip_address = require("ip-address");
|
|
33
33
|
function ipKeyGenerator(ip, ipv6Subnet = 56) {
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if ((0, import_node_net.isIPv6)(ip)) {
|
|
35
|
+
const address = new import_ip_address.Address6(ip);
|
|
36
|
+
if (address.is4()) return address.to4().correctForm();
|
|
37
|
+
if (ipv6Subnet) {
|
|
38
|
+
const subnet = new import_ip_address.Address6(`${ip}/${ipv6Subnet}`);
|
|
39
|
+
return `${subnet.startAddress().correctForm()}/${ipv6Subnet}`;
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
return ip;
|
|
38
43
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
import { isIPv6 } from "node:net";
|
|
3
3
|
import { Address6 } from "ip-address";
|
|
4
4
|
function ipKeyGenerator(ip, ipv6Subnet = 56) {
|
|
5
|
-
if (
|
|
6
|
-
|
|
5
|
+
if (isIPv6(ip)) {
|
|
6
|
+
const address = new Address6(ip);
|
|
7
|
+
if (address.is4()) return address.to4().correctForm();
|
|
8
|
+
if (ipv6Subnet) {
|
|
9
|
+
const subnet = new Address6(`${ip}/${ipv6Subnet}`);
|
|
10
|
+
return `${subnet.startAddress().correctForm()}/${ipv6Subnet}`;
|
|
11
|
+
}
|
|
7
12
|
}
|
|
8
13
|
return ip;
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-rate-limit",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
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",
|
|
@@ -73,31 +73,34 @@
|
|
|
73
73
|
"pre-commit": "lint-staged",
|
|
74
74
|
"prepare": "run-s compile && husky"
|
|
75
75
|
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"ip-address": "10.1.0"
|
|
78
|
+
},
|
|
76
79
|
"peerDependencies": {
|
|
77
80
|
"express": ">= 4.11"
|
|
78
81
|
},
|
|
79
82
|
"devDependencies": {
|
|
80
|
-
"@biomejs/biome": "2.3.
|
|
83
|
+
"@biomejs/biome": "2.3.4",
|
|
81
84
|
"@express-rate-limit/prettier": "1.1.1",
|
|
82
85
|
"@express-rate-limit/tsconfig": "1.0.2",
|
|
83
86
|
"@jest/globals": "30.2.0",
|
|
84
|
-
"@types/express": "5.0.
|
|
87
|
+
"@types/express": "5.0.6",
|
|
85
88
|
"@types/jest": "30.0.0",
|
|
86
|
-
"@types/node": "
|
|
89
|
+
"@types/node": "25.3.3",
|
|
87
90
|
"@types/supertest": "6.0.3",
|
|
88
91
|
"del-cli": "6.0.0",
|
|
89
92
|
"dts-bundle-generator": "8.1.2",
|
|
90
|
-
"esbuild": "0.
|
|
91
|
-
"express": "5.1
|
|
93
|
+
"esbuild": "0.27.3",
|
|
94
|
+
"express": "5.2.1",
|
|
92
95
|
"husky": "9.1.7",
|
|
93
96
|
"jest": "30.2.0",
|
|
94
|
-
"lint-staged": "16.
|
|
95
|
-
"mintlify": "4.2.
|
|
97
|
+
"lint-staged": "16.3.1",
|
|
98
|
+
"mintlify": "4.2.392",
|
|
96
99
|
"npm-run-all": "4.1.5",
|
|
97
|
-
"prettier": "3.
|
|
100
|
+
"prettier": "3.8.1",
|
|
98
101
|
"ratelimit-header-parser": "0.1.0",
|
|
99
|
-
"supertest": "7.
|
|
100
|
-
"ts-jest": "29.4.
|
|
102
|
+
"supertest": "7.2.2",
|
|
103
|
+
"ts-jest": "29.4.6",
|
|
101
104
|
"ts-node": "10.9.2",
|
|
102
105
|
"typescript": "5.9.3"
|
|
103
106
|
},
|
|
@@ -105,8 +108,5 @@
|
|
|
105
108
|
"lint-staged": {
|
|
106
109
|
"*.{js,ts,json}": "biome check --write",
|
|
107
110
|
"*.{md,yaml}": "prettier --write"
|
|
108
|
-
},
|
|
109
|
-
"dependencies": {
|
|
110
|
-
"ip-address": "10.0.1"
|
|
111
111
|
}
|
|
112
112
|
}
|