mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 10:26:41 +02:00
✨ feat(auth): add centralized @manacore/better-auth-types package
Create new shared package for Better Auth type definitions: - UserRole, JWTPayload, CurrentUserData types - Type guards: isValidUserRole, isValidOrganizationRole - Utility functions: jwtPayloadToCurrentUser - userAdditionalFields for client type inference Migrate shared packages to use centralized types: - @manacore/shared-auth re-exports from new package - @manacore/shared-nestjs-auth uses new package as dependency
This commit is contained in:
parent
eeab9b7fea
commit
26ca921158
9 changed files with 513 additions and 32 deletions
|
|
@ -1,12 +1,27 @@
|
|||
/**
|
||||
* User data extracted from JWT token
|
||||
* NestJS Auth Types
|
||||
*
|
||||
* Re-exports centralized types from @manacore/better-auth-types
|
||||
* plus NestJS-specific configuration interfaces.
|
||||
*/
|
||||
export interface CurrentUserData {
|
||||
userId: string;
|
||||
email: string;
|
||||
role: string;
|
||||
sessionId?: string;
|
||||
}
|
||||
|
||||
// Re-export centralized types
|
||||
export type {
|
||||
CurrentUserData,
|
||||
StrictCurrentUserData,
|
||||
JWTPayload,
|
||||
StrictJWTPayload,
|
||||
UserRole,
|
||||
OrganizationRole,
|
||||
TokenValidationResponse,
|
||||
} from '@manacore/better-auth-types';
|
||||
|
||||
export {
|
||||
isValidUserRole,
|
||||
isValidOrganizationRole,
|
||||
jwtPayloadToCurrentUser,
|
||||
jwtPayloadToStrictCurrentUser,
|
||||
} from '@manacore/better-auth-types';
|
||||
|
||||
/**
|
||||
* Configuration for the auth module
|
||||
|
|
@ -19,22 +34,3 @@ export interface AuthModuleConfig {
|
|||
/** Test user ID for development mode */
|
||||
devUserId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response from token validation endpoint
|
||||
*/
|
||||
export interface TokenValidationResponse {
|
||||
valid: boolean;
|
||||
payload?: {
|
||||
sub: string;
|
||||
email: string;
|
||||
role: string;
|
||||
sessionId?: string;
|
||||
sid?: string;
|
||||
iat?: number;
|
||||
exp?: number;
|
||||
iss?: string;
|
||||
aud?: string;
|
||||
};
|
||||
error?: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue