@adminforth/bulk-ai-flow 1.14.3 → 1.14.4
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.js +7 -2
- package/index.ts +7 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -49,8 +49,13 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
49
49
|
checkRateLimit(field, fieldNameRateLimit, headers) {
|
|
50
50
|
if (fieldNameRateLimit) {
|
|
51
51
|
// rate limit
|
|
52
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
53
|
-
|
|
52
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
53
|
+
// field,
|
|
54
|
+
// fieldNameRateLimit,
|
|
55
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
56
|
+
// );
|
|
57
|
+
const rateLimiter = new RateLimiter(fieldNameRateLimit);
|
|
58
|
+
if (!rateLimiter.consume(`${field}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
54
59
|
return { error: "Rate limit exceeded" };
|
|
55
60
|
}
|
|
56
61
|
}
|
package/index.ts
CHANGED
|
@@ -57,12 +57,13 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
57
57
|
private checkRateLimit(field: string,fieldNameRateLimit: string | undefined, headers: Record<string, string | string[] | undefined>): { error?: string } | void {
|
|
58
58
|
if (fieldNameRateLimit) {
|
|
59
59
|
// rate limit
|
|
60
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
|
|
60
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
61
|
+
// field,
|
|
62
|
+
// fieldNameRateLimit,
|
|
63
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
64
|
+
// );
|
|
65
|
+
const rateLimiter = new RateLimiter(fieldNameRateLimit);
|
|
66
|
+
if (!rateLimiter.consume(`${field}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
66
67
|
return { error: "Rate limit exceeded" };
|
|
67
68
|
}
|
|
68
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/bulk-ai-flow",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@types/handlebars": "^4.0.40",
|
|
30
|
-
"adminforth": "^2.4.0-next.
|
|
30
|
+
"adminforth": "^2.4.0-next.222",
|
|
31
31
|
"handlebars": "^4.7.8"
|
|
32
32
|
},
|
|
33
33
|
"release": {
|