@adminforth/rich-editor 1.5.0 → 1.5.2

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/build.log CHANGED
@@ -10,5 +10,5 @@ custom/package.json
10
10
  custom/quillEditor.vue
11
11
  custom/tsconfig.json
12
12
 
13
- sent 21,698 bytes received 115 bytes 43,626.00 bytes/sec
13
+ sent 21,704 bytes received 115 bytes 43,638.00 bytes/sec
14
14
  total size is 21,281 speedup is 0.98
package/dist/index.js CHANGED
@@ -219,8 +219,13 @@ export default class RichEditorPlugin extends AdminForthPlugin {
219
219
  const { record } = body;
220
220
  if ((_b = this.options.completion.rateLimit) === null || _b === void 0 ? void 0 : _b.limit) {
221
221
  // rate limit
222
- const { error } = RateLimiter.checkRateLimit(this.pluginInstanceId, (_c = this.options.completion.rateLimit) === null || _c === void 0 ? void 0 : _c.limit, this.adminforth.auth.getClientIp(headers));
223
- if (error) {
222
+ // const { error } = RateLimiter.checkRateLimit(
223
+ // this.pluginInstanceId,
224
+ // this.options.completion.rateLimit?.limit,
225
+ // this.adminforth.auth.getClientIp(headers),
226
+ // );
227
+ const rateLimiter = new RateLimiter((_c = this.options.completion.rateLimit) === null || _c === void 0 ? void 0 : _c.limit);
228
+ if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
224
229
  return {
225
230
  completion: [],
226
231
  };
package/index.ts CHANGED
@@ -273,12 +273,13 @@ export default class RichEditorPlugin extends AdminForthPlugin {
273
273
 
274
274
  if (this.options.completion.rateLimit?.limit) {
275
275
  // rate limit
276
- const { error } = RateLimiter.checkRateLimit(
277
- this.pluginInstanceId,
278
- this.options.completion.rateLimit?.limit,
279
- this.adminforth.auth.getClientIp(headers),
280
- );
281
- if (error) {
276
+ // const { error } = RateLimiter.checkRateLimit(
277
+ // this.pluginInstanceId,
278
+ // this.options.completion.rateLimit?.limit,
279
+ // this.adminforth.auth.getClientIp(headers),
280
+ // );
281
+ const rateLimiter = new RateLimiter(this.options.completion.rateLimit?.limit);
282
+ if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
282
283
  return {
283
284
  completion: [],
284
285
  }
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@adminforth/rich-editor",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Rich editor plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
8
11
  "scripts": {
9
12
  "prepare": "npm link adminforth",
10
13
  "build": "tsc && rsync -av --exclude 'node_modules' custom dist/"
@@ -21,6 +24,7 @@
21
24
  "author": "devforth",
22
25
  "license": "ISC",
23
26
  "dependencies": {
27
+ "adminforth": "^2.4.0-next.222",
24
28
  "cheerio": "^1.0.0"
25
29
  },
26
30
  "devDependencies": {