@adminforth/text-complete 2.1.0 → 2.1.1

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 CHANGED
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { AdminForthPlugin, AdminForthDataTypes, RateLimiter, parseBody } from "adminforth";
10
+ import { AdminForthPlugin, AdminForthDataTypes, RateLimiter } from "adminforth";
11
11
  import { z } from "zod";
12
12
  const doCompleteBodySchema = z.object({
13
13
  record: z.record(z.string(), z.any()),
@@ -70,12 +70,10 @@ export default class TextCompletePlugin extends AdminForthPlugin {
70
70
  server.endpoint({
71
71
  method: 'POST',
72
72
  path: `/plugin/${this.pluginInstanceId}/doComplete`,
73
- handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, headers, response }) {
73
+ request_schema: doCompleteBodySchema,
74
+ handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, headers }) {
74
75
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
75
- const parsed = parseBody(doCompleteBodySchema, body, response);
76
- if ('error' in parsed)
77
- return parsed.error;
78
- const data = parsed.data;
76
+ const data = body;
79
77
  if (this.rateLimiter) {
80
78
  // rate limit
81
79
  // const { error } = RateLimiter.checkRateLimit(
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { IAdminForth, IHttpServer, AdminForthPlugin, AdminForthResource, AdminForthDataTypes, RateLimiter, parseBody } from "adminforth";
2
+ import { IAdminForth, IHttpServer, AdminForthPlugin, AdminForthResource, AdminForthDataTypes, RateLimiter } from "adminforth";
3
3
  import { PluginOptions } from './types.js';
4
4
  import { z } from "zod";
5
5
 
@@ -87,10 +87,9 @@ export default class TextCompletePlugin extends AdminForthPlugin {
87
87
  server.endpoint({
88
88
  method: 'POST',
89
89
  path: `/plugin/${this.pluginInstanceId}/doComplete`,
90
- handler: async ({ body, headers, response }) => {
91
- const parsed = parseBody(doCompleteBodySchema, body, response);
92
- if ('error' in parsed) return parsed.error;
93
- const data = parsed.data;
90
+ request_schema: doCompleteBodySchema,
91
+ handler: async ({ body, headers }) => {
92
+ const data = body as z.infer<typeof doCompleteBodySchema>;
94
93
  if (this.rateLimiter) {
95
94
  // rate limit
96
95
  // const { error } = RateLimiter.checkRateLimit(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/text-complete",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Text completion plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.10.7",
30
- "adminforth": "^3.7.1",
30
+ "adminforth": "^3.8.2",
31
31
  "semantic-release": "^24.2.1",
32
32
  "semantic-release-slack-bot": "^4.0.2",
33
33
  "typescript": "^5.7.3"
@@ -58,6 +58,6 @@
58
58
  ]
59
59
  },
60
60
  "peerDependencies": {
61
- "adminforth": "^3.7.1"
61
+ "adminforth": "^3.8.2"
62
62
  }
63
63
  }