@meistrari/auth-core 1.32.0 → 1.33.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.d.mts CHANGED
@@ -6310,6 +6310,13 @@ declare class AdminService {
6310
6310
  data: ListAdminUsersResult;
6311
6311
  error: null;
6312
6312
  }>;
6313
+ /**
6314
+ * Fetches a single user by ID.
6315
+ *
6316
+ * @param userId - The ID of the user to fetch
6317
+ * @returns The user
6318
+ */
6319
+ getUser(userId: string): Promise<AdminUser>;
6313
6320
  /**
6314
6321
  * Fetches a single organization, optionally with adjacent IDs in
6315
6322
  * the listing defined by the ordering options.
@@ -6477,8 +6484,14 @@ declare class AdminService {
6477
6484
  * Result of accepting an organization invitation.
6478
6485
  */
6479
6486
  type AcceptInvitationResult = {
6487
+ /** The scoped application's ID, or `null` for a plain organization invitation. */
6488
+ applicationId: string | null;
6489
+ /** The scoped application's display name, or `null` for a plain organization invitation. */
6490
+ applicationName: string | null;
6480
6491
  /** Application home URL for application-scoped invitations, otherwise `null`. */
6481
6492
  homeUrl: string | null;
6493
+ /** Configured post-acceptance URL for plain organization invitations. */
6494
+ inviteAcceptedUrl: string | null;
6482
6495
  /** The accepted organization membership. This may be an existing membership. */
6483
6496
  member: Member;
6484
6497
  };
@@ -6736,8 +6749,8 @@ declare class OrganizationService {
6736
6749
  * Accepts an organization invitation.
6737
6750
  *
6738
6751
  * @param id - The invitation ID to accept
6739
- * @returns The accepted member and the application's `homeUrl` when the invitation
6740
- * is scoped to an application that defines one; otherwise `null`.
6752
+ * @returns The accepted member, application context for app-scoped invitations,
6753
+ * and the configured post-acceptance URL for plain organization invitations.
6741
6754
  */
6742
6755
  acceptInvitation(id: string): Promise<AcceptInvitationResult>;
6743
6756
  /**
package/dist/index.d.ts CHANGED
@@ -6310,6 +6310,13 @@ declare class AdminService {
6310
6310
  data: ListAdminUsersResult;
6311
6311
  error: null;
6312
6312
  }>;
6313
+ /**
6314
+ * Fetches a single user by ID.
6315
+ *
6316
+ * @param userId - The ID of the user to fetch
6317
+ * @returns The user
6318
+ */
6319
+ getUser(userId: string): Promise<AdminUser>;
6313
6320
  /**
6314
6321
  * Fetches a single organization, optionally with adjacent IDs in
6315
6322
  * the listing defined by the ordering options.
@@ -6477,8 +6484,14 @@ declare class AdminService {
6477
6484
  * Result of accepting an organization invitation.
6478
6485
  */
6479
6486
  type AcceptInvitationResult = {
6487
+ /** The scoped application's ID, or `null` for a plain organization invitation. */
6488
+ applicationId: string | null;
6489
+ /** The scoped application's display name, or `null` for a plain organization invitation. */
6490
+ applicationName: string | null;
6480
6491
  /** Application home URL for application-scoped invitations, otherwise `null`. */
6481
6492
  homeUrl: string | null;
6493
+ /** Configured post-acceptance URL for plain organization invitations. */
6494
+ inviteAcceptedUrl: string | null;
6482
6495
  /** The accepted organization membership. This may be an existing membership. */
6483
6496
  member: Member;
6484
6497
  };
@@ -6736,8 +6749,8 @@ declare class OrganizationService {
6736
6749
  * Accepts an organization invitation.
6737
6750
  *
6738
6751
  * @param id - The invitation ID to accept
6739
- * @returns The accepted member and the application's `homeUrl` when the invitation
6740
- * is scoped to an application that defines one; otherwise `null`.
6752
+ * @returns The accepted member, application context for app-scoped invitations,
6753
+ * and the configured post-acceptance URL for plain organization invitations.
6741
6754
  */
6742
6755
  acceptInvitation(id: string): Promise<AcceptInvitationResult>;
6743
6756
  /**
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { defaultStatements } from 'better-auth/plugins/organization/access';
8
8
  import z, { z as z$1 } from 'zod';
9
9
  export { APIError } from 'better-auth';
10
10
 
11
- const version = "1.32.0";
11
+ const version = "1.33.1";
12
12
 
13
13
  function parsedEnumValues(schema) {
14
14
  return Object.fromEntries(
@@ -459,6 +459,25 @@ class AdminService {
459
459
  }
460
460
  });
461
461
  }
462
+ /**
463
+ * Fetches a single user by ID.
464
+ *
465
+ * @param userId - The ID of the user to fetch
466
+ * @returns The user
467
+ */
468
+ async getUser(userId) {
469
+ const user = await this.client.admin.getUser({
470
+ query: { id: userId }
471
+ });
472
+ return {
473
+ ...user,
474
+ image: user.image ?? null,
475
+ role: user.role ?? null,
476
+ banReason: user.banReason ?? null,
477
+ banExpires: user.banExpires ?? null,
478
+ type: "user"
479
+ };
480
+ }
462
481
  /**
463
482
  * Fetches a single organization, optionally with adjacent IDs in
464
483
  * the listing defined by the ordering options.
@@ -1366,16 +1385,19 @@ class OrganizationService {
1366
1385
  * Accepts an organization invitation.
1367
1386
  *
1368
1387
  * @param id - The invitation ID to accept
1369
- * @returns The accepted member and the application's `homeUrl` when the invitation
1370
- * is scoped to an application that defines one; otherwise `null`.
1388
+ * @returns The accepted member, application context for app-scoped invitations,
1389
+ * and the configured post-acceptance URL for plain organization invitations.
1371
1390
  */
1372
1391
  async acceptInvitation(id) {
1373
1392
  const response = await this.client.organization.acceptInvitation({
1374
1393
  invitationId: id
1375
1394
  });
1376
- const responseWithHomeUrl = response;
1395
+ const responseWithContext = response;
1377
1396
  return {
1378
- homeUrl: responseWithHomeUrl.homeUrl ?? null,
1397
+ applicationId: responseWithContext.applicationId ?? responseWithContext.invitation?.applicationId ?? null,
1398
+ applicationName: responseWithContext.applicationName ?? null,
1399
+ homeUrl: responseWithContext.homeUrl ?? null,
1400
+ inviteAcceptedUrl: responseWithContext.inviteAcceptedUrl ?? null,
1379
1401
  member: response.member
1380
1402
  };
1381
1403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/auth-core",
3
- "version": "1.32.0",
3
+ "version": "1.33.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {