Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-rate-limiter

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-rate-limiter - npm Package Compare versions

Comparing version 2.6.1-alpha to 2.6.5

dist/default-options.spec.d.ts

3

dist/default-options.js

@@ -28,4 +28,3 @@ "use strict";

maxQueueSize: 100,
errorMessage: 'Rate limit exceeded',
limiterKey: undefined
errorMessage: 'Rate limit exceeded'
};

@@ -5,2 +5,3 @@ "use strict";

const common_1 = require("@nestjs/common");
exports.RateLimit = (options) => common_1.SetMetadata('rateLimit', options);
const RateLimit = (options) => common_1.SetMetadata('rateLimit', options);
exports.RateLimit = RateLimit;

@@ -163,3 +163,3 @@ "use strict";

const rateLimiter = yield this.getRateLimiter(reflectedOptions);
const key = this.spesificOptions.limiterKey || request.ip.replace(/^.*:/, '');
const key = request.ip.replace(/^.*:/, '');
yield this.responseHandler(response, key, rateLimiter, points, pointsConsumed);

@@ -192,3 +192,3 @@ return next.handle();

return __awaiter(this, void 0, void 0, function* () {
if (this.spesificOptions.for === 'Fastify' || this.spesificOptions.for === 'FastifyGraphql') {
if (this.options.for === 'Fastify' || this.options.for === 'FastifyGraphql') {
try {

@@ -195,0 +195,0 @@ if (((_a = this.spesificOptions) === null || _a === void 0 ? void 0 : _a.queueEnabled) || this.options.queueEnabled)

@@ -28,3 +28,2 @@ import { Provider } from '@nestjs/common';

errorMessage?: string;
limiterKey?: string;
}

@@ -31,0 +30,0 @@ export interface RateLimiterOptionsFactory {

{
"name": "nestjs-rate-limiter",
"version": "2.6.1-alpha",
"version": "2.6.5",
"description": "Highly configurable rate limiter library",

@@ -31,5 +31,5 @@ "repository": {

"scripts": {
"prebuild": "rm -rf dist",
"build": "tsc -p tsconfig.json",
"lint": "prettier --write lib"
"build": "rm -rf dist && tsc -p tsconfig.json",
"lint": "prettier --write lib",
"test": "jest --config ./jest.config.js"
},

@@ -42,3 +42,5 @@ "dependencies": {

"@nestjs/core": "latest",
"@types/jest": "^26.0.15",
"@types/node": "^14.11.1",
"jest": "^26.6.3",
"prettier": "^2.1.1",

@@ -48,4 +50,5 @@ "reflect-metadata": "0.1.13",

"ts-node": "^9.0.0",
"ts-jest": "^26.4.4",
"typescript": "^4.0.2"
}
}

@@ -51,2 +51,3 @@ <p align="center">

- [TODO List](https://github.com/ozkanonur/nestjs-rate-limiter#todo)
- [Examples](https://github.com/ozkanonur/nestjs-rate-limiter/examples/README.md)

@@ -138,3 +139,3 @@ # Description

@RateLimit({ points: 1, duration: 60, errorMessage: 'Accounts cannot be created more than once in per minute' })
@RateLimit({ keyPrefix: 'sign-up', points: 1, duration: 60, errorMessage: 'Accounts cannot be created more than once in per minute' })
@Get('/signup')

@@ -423,10 +424,2 @@ public async signUp() {

#### ● limiterKey
<code> Default: Client's Ip Address </code>
<br>
<code> Type: string</code>
<br>
limiterKey option allows you to control scenarios such as applying rate limiter based on User Account instead of Ip Address
# Benchmarks

@@ -433,0 +426,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc