express-rate-limit 8.2.0 → 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 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 (ipv6Subnet && (0, import_node_net.isIPv6)(ip)) {
35
- return `${new import_ip_address.Address6(`${ip}/${ipv6Subnet}`).startAddress().correctForm()}/${ipv6Subnet}`;
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
  }
@@ -546,8 +551,12 @@ var validations = {
546
551
  passOnStoreError: true
547
552
  };
548
553
  const validOptions = Object.keys(optionsMap).concat(
549
- "draft_polli_ratelimit_headers"
554
+ "draft_polli_ratelimit_headers",
550
555
  // not a valid option anymore, but we have a more specific check for this one, so don't warn for it here
556
+ // from express-slow-down - https://github.com/express-rate-limit/express-slow-down/blob/main/source/types.ts#L65
557
+ "delayAfter",
558
+ "delayMs",
559
+ "maxDelayMs"
551
560
  );
552
561
  for (const key of Object.keys(passedOptions)) {
553
562
  if (!validOptions.includes(key)) {
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 (ipv6Subnet && isIPv6(ip)) {
6
- return `${new Address6(`${ip}/${ipv6Subnet}`).startAddress().correctForm()}/${ipv6Subnet}`;
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
  }
@@ -517,8 +522,12 @@ var validations = {
517
522
  passOnStoreError: true
518
523
  };
519
524
  const validOptions = Object.keys(optionsMap).concat(
520
- "draft_polli_ratelimit_headers"
525
+ "draft_polli_ratelimit_headers",
521
526
  // not a valid option anymore, but we have a more specific check for this one, so don't warn for it here
527
+ // from express-slow-down - https://github.com/express-rate-limit/express-slow-down/blob/main/source/types.ts#L65
528
+ "delayAfter",
529
+ "delayMs",
530
+ "maxDelayMs"
522
531
  );
523
532
  for (const key of Object.keys(passedOptions)) {
524
533
  if (!validOptions.includes(key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "8.2.0",
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.1",
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.4",
87
+ "@types/express": "5.0.6",
85
88
  "@types/jest": "30.0.0",
86
- "@types/node": "24.9.1",
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.25.11",
91
- "express": "5.1.0",
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.2.6",
95
- "mintlify": "4.2.179",
97
+ "lint-staged": "16.3.1",
98
+ "mintlify": "4.2.392",
96
99
  "npm-run-all": "4.1.5",
97
- "prettier": "3.6.2",
100
+ "prettier": "3.8.1",
98
101
  "ratelimit-header-parser": "0.1.0",
99
- "supertest": "7.1.4",
100
- "ts-jest": "29.4.5",
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
  }