@adminforth/email-invite 1.2.0 → 1.2.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 AdminForth, { AdminForthPlugin, parseBody, suggestIfTypo, Filters, afLogger } from "adminforth";
10
+ import AdminForth, { AdminForthPlugin, suggestIfTypo, Filters, afLogger } from "adminforth";
11
11
  import { z } from "zod";
12
12
  const setPasswordBodySchema = z.object({
13
13
  token: z.string(),
@@ -205,11 +205,9 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
205
205
  method: 'POST',
206
206
  path: `/plugin/${this.pluginInstanceId}/set-password`,
207
207
  noAuth: true,
208
+ request_schema: setPasswordBodySchema,
208
209
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
209
- const parsed = parseBody(setPasswordBodySchema, body, response);
210
- if ('error' in parsed)
211
- return parsed.error;
212
- const data = parsed.data;
210
+ const data = body;
213
211
  const { token, password } = data;
214
212
  try {
215
213
  const decoded = yield this.adminforth.auth.verify(token, 'inviteUser', false);
@@ -259,11 +257,9 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
259
257
  server.endpoint({
260
258
  method: 'POST',
261
259
  path: `/plugin/${this.pluginInstanceId}/resend-invite`,
260
+ request_schema: resendInviteBodySchema,
262
261
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, response }) {
263
- const parsed = parseBody(resendInviteBodySchema, body, response);
264
- if ('error' in parsed)
265
- return parsed.error;
266
- const data = parsed.data;
262
+ const data = body;
267
263
  const { recordId } = data;
268
264
  try {
269
265
  // Get the user record
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import AdminForth, { AdminForthPlugin, parseBody, suggestIfTypo, Filters, afLogger } from "adminforth";
1
+ import AdminForth, { AdminForthPlugin, suggestIfTypo, Filters, afLogger } from "adminforth";
2
2
  import type { IAdminForth, IHttpServer, AdminForthResourcePages, AdminForthResourceColumn, AdminForthDataTypes, AdminForthResource, AdminUser, HttpExtra } from "adminforth";
3
3
  import type { PluginOptions } from './types.js';
4
4
  import { z } from "zod";
@@ -252,10 +252,9 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
252
252
  method: 'POST',
253
253
  path: `/plugin/${this.pluginInstanceId}/set-password`,
254
254
  noAuth: true,
255
+ request_schema: setPasswordBodySchema,
255
256
  handler: async ({ body, response }) => {
256
- const parsed = parseBody(setPasswordBodySchema, body, response);
257
- if ('error' in parsed) return parsed.error;
258
- const data = parsed.data;
257
+ const data = body as z.infer<typeof setPasswordBodySchema>;
259
258
  const { token, password } = data;
260
259
 
261
260
  try {
@@ -321,10 +320,9 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
321
320
  server.endpoint({
322
321
  method: 'POST',
323
322
  path: `/plugin/${this.pluginInstanceId}/resend-invite`,
323
+ request_schema: resendInviteBodySchema,
324
324
  handler: async ({ body, adminUser, response }) => {
325
- const parsed = parseBody(resendInviteBodySchema, body, response);
326
- if ('error' in parsed) return parsed.error;
327
- const data = parsed.data;
325
+ const data = body as z.infer<typeof resendInviteBodySchema>;
328
326
  const { recordId } = data;
329
327
 
330
328
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/email-invite",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.10.7",
24
- "adminforth": "^3.7.1",
24
+ "adminforth": "^3.8.2",
25
25
  "semantic-release": "^24.2.1",
26
26
  "semantic-release-slack-bot": "^4.0.2",
27
27
  "typescript": "^5.7.3"
28
28
  },
29
29
  "peerDependencies": {
30
- "adminforth": "^3.7.1"
30
+ "adminforth": "^3.8.2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"