* Map a Better Auth session to our AuthSession type.
(baSession: {
user: { id: string; email: string; name?: string };
session: { token: string; activeOrganizationId?: string };
})
| 958 | * Map a Better Auth session to our AuthSession type. |
| 959 | */ |
| 960 | function mapBetterAuthSession(baSession: { |
| 961 | user: { id: string; email: string; name?: string }; |
| 962 | session: { token: string; activeOrganizationId?: string }; |
| 963 | }): AuthSession { |
| 964 | return { |
| 965 | email: baSession.user.email, |
| 966 | userId: baSession.user.id, |
| 967 | name: baSession.user.name, |
| 968 | token: baSession.session?.token, |
| 969 | orgId: baSession.session?.activeOrganizationId ?? undefined, |
| 970 | }; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * Get the current auth session for a request. |