import { Inject, Injectable, OnModuleInit } from '@nestjs/common'; import { ClientGrpc } from '@nestjs/microservices'; import { Observable } from 'rxjs'; type GrpcMethod = (request: TRequest) => Observable; @Injectable() export class CoreGrpcService implements OnModuleInit { auth!: Record; admin!: Record; rbac!: Record; security!: Record; settings!: Record; profile!: Record; documents!: Record; addresses!: Record; oauth!: Record; otp!: Record; advancedAuth!: Record; notifications!: Record; chat!: Record; family!: Record; media!: Record; bot!: Record; constructor(@Inject('SSO_CORE') private readonly client: ClientGrpc) {} onModuleInit() { this.auth = this.client.getService>('AuthService'); this.admin = this.client.getService>('AdminService'); this.rbac = this.client.getService>('RbacService'); this.security = this.client.getService>('SecurityService'); this.settings = this.client.getService>('SettingsService'); this.profile = this.client.getService>('ProfileService'); this.documents = this.client.getService>('DocumentsService'); this.addresses = this.client.getService>('AddressesService'); this.oauth = this.client.getService>('OAuthCoreService'); this.otp = this.client.getService>('OtpService'); this.advancedAuth = this.client.getService>('AdvancedAuthService'); this.family = this.client.getService>('FamilyService'); this.notifications = this.client.getService>('NotificationsService'); this.chat = this.client.getService>('ChatService'); this.media = this.client.getService>('MediaService'); this.bot = this.client.getService>('BotService'); } }