@absolutejs/auth 0.86.0 → 0.86.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.
@@ -100,6 +100,7 @@ export declare const organizationRoutes: <UserType>({ authSessionStore, canCreat
100
100
  property?: string;
101
101
  expected?: string;
102
102
  };
103
+ 502: "Invitation delivery failed; create a new invitation to retry";
103
104
  };
104
105
  error: never;
105
106
  };
package/dist/server.js CHANGED
@@ -11427,13 +11427,21 @@ var organizationRoutes = ({
11427
11427
  organizationStore,
11428
11428
  roles: roles ?? []
11429
11429
  });
11430
- await onSendInvitation?.({
11431
- email: invitation.email,
11432
- expiresAt: invitation.expiresAt,
11433
- inviterUserId: invitation.inviterUserId,
11434
- organizationId,
11435
- token
11436
- });
11430
+ try {
11431
+ await onSendInvitation?.({
11432
+ email: invitation.email,
11433
+ expiresAt: invitation.expiresAt,
11434
+ inviterUserId: invitation.inviterUserId,
11435
+ organizationId,
11436
+ token
11437
+ });
11438
+ } catch {
11439
+ await organizationStore.saveInvitation({
11440
+ ...invitation,
11441
+ state: "revoked"
11442
+ });
11443
+ return status("Bad Gateway", "Invitation delivery failed; create a new invitation to retry");
11444
+ }
11437
11445
  await emit?.({
11438
11446
  at: Date.now(),
11439
11447
  metadata: { email: invitation.email },
@@ -11541,7 +11549,7 @@ var organizationRoutes = ({
11541
11549
  return status("Unauthorized", "Authentication required");
11542
11550
  }
11543
11551
  const membership = await organizationStore.getMembership(organizationId, getUserId(user));
11544
- if (membership?.status !== "active") {
11552
+ if (membership?.status !== "active" && !await mayManage(user, organizationId)) {
11545
11553
  return status("Forbidden", "Not a member");
11546
11554
  }
11547
11555
  const members = await organizationStore.listMembershipsByOrganization(organizationId);
@@ -42247,5 +42255,5 @@ export {
42247
42255
  userSessionIdTypebox
42248
42256
  };
42249
42257
 
42250
- //# debugId=0AD53C59A773867564756E2164756E21
42258
+ //# debugId=E5C70909EAE2DA0864756E2164756E21
42251
42259
  //# sourceMappingURL=server.js.map