@omnitron-dev/titan-ratelimit 0.4.6 → 0.4.8
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/README.md +26 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
# @omnitron-dev/titan-ratelimit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Request and operation rate limits for Titan services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Capabilities
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Fixed-window, sliding-window and token-bucket strategies.
|
|
8
|
+
- Memory or Redis storage selected by configuration.
|
|
9
|
+
- Service decorators and HTTP middleware.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```sh
|
|
10
14
|
pnpm add @omnitron-dev/titan-ratelimit
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
```ts
|
|
18
|
+
import { TitanRateLimitModule } from '@omnitron-dev/titan-ratelimit';
|
|
19
|
+
|
|
20
|
+
export const ratelimit = TitanRateLimitModule.forRoot({
|
|
21
|
+
storageType: 'memory',
|
|
22
|
+
strategy: 'sliding-window',
|
|
23
|
+
defaultLimit: 100,
|
|
24
|
+
defaultWindowMs: 60_000,
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add this dynamic module to the `imports` of an existing Titan application.
|
|
29
|
+
|
|
30
|
+
Memory limits belong to one process. Configure Redis when multiple instances must share a budget, and derive keys from admitted identity rather than untrusted headers. Rate limiting supplements authentication and resource authorization.
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
[Public API](src/index.ts) · [Package exports](package.json) · [Omni](../../README.md)
|
|
16
35
|
|
|
17
36
|
## License
|
|
18
37
|
|
|
19
|
-
MIT
|
|
38
|
+
[MIT](../../LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnitron-dev/titan-ratelimit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Rate limiting module for Titan framework with Redis-backed storage",
|
|
5
5
|
"author": "LuxQuant",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"reflect-metadata": "^0.2.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@omnitron-dev/titan": "0.4.
|
|
24
|
-
"@omnitron-dev/titan-redis": "0.4.
|
|
23
|
+
"@omnitron-dev/titan": "0.4.8",
|
|
24
|
+
"@omnitron-dev/titan-redis": "0.4.8"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@omnitron-dev/titan": "0.4.
|
|
28
|
-
"@omnitron-dev/titan-redis": "0.4.
|
|
27
|
+
"@omnitron-dev/titan": "0.4.8",
|
|
28
|
+
"@omnitron-dev/titan-redis": "0.4.8",
|
|
29
29
|
"@types/node": "26.6.6",
|
|
30
30
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
31
31
|
"vitest": "^5.0.5",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"url": "git+https://github.com/omnitron-dev/omni.git",
|
|
37
37
|
"directory": "packages/titan-ratelimit"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "1ae8568eebc2581e2cc2428bd3ca1cf570ed3f03",
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "../../scripts/build-package.sh -p ./tsconfig.json",
|
|
42
42
|
"test": "vitest run",
|