import { BadRequestException } from '@nestjs/common'; import { CommandBus } from '@nestjs/cqrs'; import { ConfigService } from '@nestjs/config'; import { IAuthResponse, IChangePasswordRequest, ID, IResetPasswordRequest, IUserEmailInput, IUserRegistrationInput, LanguagesEnum } from '@metad/contracts'; import { SocialAuthService } from '@metad/server-auth'; import { IEnvironment } from '@metad/server-config'; import { I18nService } from 'nestjs-i18n'; import { FindOptionsWhere } from 'typeorm'; import { EmailService } from '../email/email.service'; import { UserOrganizationService } from '../user-organization/user-organization.services'; import { User } from '../user/user.entity'; import { UserService } from '../user/user.service'; import { RoleService } from '../role/role.service'; export declare class AuthService extends SocialAuthService { private readonly userService; private readonly roleService; private emailService; private userOrganizationService; private readonly i18n; private readonly _configService; private readonly commandBus; private readonly logger; private readonly userRepository; constructor(userService: UserService, roleService: RoleService, emailService: EmailService, userOrganizationService: UserOrganizationService, i18n: I18nService, _configService: ConfigService, commandBus: CommandBus); validateUser(email: string, password: string): Promise; /** * User Login Request * * @param email username or email * @param password * @returns */ login(email: string, password: string): Promise; requestPassword(request: FindOptionsWhere, languageCode: LanguagesEnum, originUrl?: string): Promise; /** * Initiates the process to request a password reset. * * @param request - The reset password request object containing the email address. * @param languageCode - The language code used for email communication. * @param originUrl - Optional parameter representing the origin URL of the request. * @returns A Promise that resolves to a boolean indicating the success of the password reset request * or throws a BadRequestException in case of failure. */ requestResetPassword(request: IResetPasswordRequest, languageCode: LanguagesEnum, originUrl?: string): Promise; /** * Generates a password reset link. * * @param baseURL The base URL for the reset password page. * @param token The token generated for the password reset. * @param email The email of the user. * @param tenantId The tenant ID (optional). * @returns The password reset link. */ generateResetLink(baseURL: string, token: string, email: string, tenantId?: ID): string; /** * Fetch users from the repository based on specific criteria. * * @param {string} email - The user's email address. * @returns {Promise} A Promise that resolves to an array of User objects. */ fetchUsers(email: IUserEmailInput['email']): Promise; /** * Change password * * @param request */ resetPassword(request: IChangePasswordRequest): Promise; /** * signup for free user */ signup(input: IUserRegistrationInput, languageCode: LanguagesEnum): Promise; /** * Shared method involved in * 1. Sign up * 2. Addition of new user to organization * 3. User invite accept scenario * * @param input * @param languageCode * @returns */ register(input: IUserRegistrationInput, languageCode: LanguagesEnum): Promise; getAuthenticatedUser(id: string, thirdPartyId?: string): Promise; isAuthenticated(token: string): Promise; hasRole(token: string, roles?: string[]): Promise; validateOAuthLoginUser(args: any): Promise<{ success: boolean; authData: { jwt: string; refreshToken: string; userId: string; }; }>; validateOAuthLoginEmail(emails: Array<{ value: string; verified: boolean; }>): Promise<{ success: boolean; authData: { jwt: string; userId: string; }; }>; validateOAuthLoginMobile(args: any): Promise<{ success: boolean; authData: { jwt: string; refreshToken: string; userId: string; }; }>; refreshTokens(userId: string, refreshToken: string): Promise<{ token: string; refreshToken: string; }>; updateRefreshToken(userId: string, refreshToken: string): Promise; createToken(user: Partial): Promise<{ token: string; refreshToken: string; }>; verifyEmail(token: string): Promise; resendVerificationMail(user: User, languageCode: LanguagesEnum): Promise; }