@adminforth/many2many 1.3.0 → 1.3.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, parseBody, Filters } from "adminforth";
10
+ import { AdminForthPlugin, Filters } from "adminforth";
11
11
  import { z } from "zod";
12
12
  const getJunctionRecordsBodySchema = z.object({
13
13
  recordId: z.union([z.string(), z.number()]).nullish(),
@@ -198,11 +198,9 @@ export default class ManyToManyPlugin extends AdminForthPlugin {
198
198
  server.endpoint({
199
199
  method: 'POST',
200
200
  path: `/plugin/${this.pluginInstanceId}/get-junctionResource-records`,
201
+ request_schema: getJunctionRecordsBodySchema,
201
202
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
202
- const parsed = parseBody(getJunctionRecordsBodySchema, body, response);
203
- if ('error' in parsed)
204
- return parsed.error;
205
- const data = parsed.data;
203
+ const data = body;
206
204
  const { recordId, returnLabels } = data;
207
205
  if (recordId === undefined || recordId === null || recordId === '') {
208
206
  return { ok: true, data: [] };
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AdminForthPlugin, parseBody, Filters } from "adminforth";
1
+ import { AdminForthPlugin, Filters } from "adminforth";
2
2
  import type { IAdminForth, IHttpServer, AdminForthResourcePages, AdminForthResourceColumn, AdminForthDataTypes, AdminForthResource } from "adminforth";
3
3
  import type { PluginOptions } from './types.js';
4
4
  import { z } from "zod";
@@ -200,10 +200,9 @@ export default class ManyToManyPlugin extends AdminForthPlugin {
200
200
  server.endpoint({
201
201
  method: 'POST',
202
202
  path: `/plugin/${this.pluginInstanceId}/get-junctionResource-records`,
203
+ request_schema: getJunctionRecordsBodySchema,
203
204
  handler: async ({ body, response }) => {
204
- const parsed = parseBody(getJunctionRecordsBodySchema, body, response);
205
- if ('error' in parsed) return parsed.error;
206
- const data = parsed.data;
205
+ const data = body as z.infer<typeof getJunctionRecordsBodySchema>;
207
206
  const { recordId, returnLabels } = data;
208
207
  if (recordId === undefined || recordId === null || recordId === '') {
209
208
  return { ok: true, data: [] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/many2many",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "latest",
48
- "adminforth": "^3.7.1",
48
+ "adminforth": "^3.8.2",
49
49
  "semantic-release": "^24.2.1",
50
50
  "semantic-release-slack-bot": "^4.0.2",
51
51
  "typescript": "^5.7.3"
52
52
  },
53
53
  "peerDependencies": {
54
- "adminforth": "^3.7.1"
54
+ "adminforth": "^3.8.2"
55
55
  }
56
56
  }