Skip to content

Commit

Permalink
feat: make injected services protected in core services
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMaz committed Feb 21, 2024
1 parent 1eae78c commit d2e6f4c
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export class AuthLocalValidateUserService
{
constructor(
@Inject(AUTH_LOCAL_MODULE_USER_LOOKUP_SERVICE_TOKEN)
private userLookupService: AuthLocalUserLookupServiceInterface,
protected readonly userLookupService: AuthLocalUserLookupServiceInterface,
@Inject(AUTH_LOCAL_MODULE_PASSWORD_VALIDATION_SERVICE_TOKEN)
private passwordValidationService: PasswordValidationServiceInterface,
protected readonly passwordValidationService: PasswordValidationServiceInterface,
) {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AuthenticationJwtResponseDto } from '../dto/authentication-jwt-response

@Injectable()
export class IssueTokenService implements IssueTokenServiceInterface {
constructor(private jwtIssueService: JwtIssueService) {}
constructor(protected readonly jwtIssueService: JwtIssueService) {}

/**
* Generate access token for a payload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { VerifyTokenServiceInterface } from '../interfaces/verify-token-service.
@Injectable()
export class VerifyTokenService implements VerifyTokenServiceInterface {
constructor(
private jwtVerifyService: JwtVerifyService,
protected readonly jwtVerifyService: JwtVerifyService,
@Optional()
@Inject(AUTHENTICATION_MODULE_VALIDATE_TOKEN_SERVICE_TOKEN)
private validateTokenService?: ValidateTokenServiceInterface,
protected readonly validateTokenService?: ValidateTokenServiceInterface,
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-crud/src/services/typeorm-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class TypeOrmCrudService<
super(repo);
}

private crudQueryHelper: CrudQueryHelper = new CrudQueryHelper();
protected readonly crudQueryHelper: CrudQueryHelper = new CrudQueryHelper();

async getMany(
req: CrudRequest,
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs-email/src/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { EmailServiceInterface } from './interfaces/email-service.interface';
@Injectable()
export class EmailService implements EmailServiceInterface {
constructor(
private logger: Logger,
protected readonly logger: Logger,
@Inject('EMAIL_MODULE_MAILER_SERVICE_TOKEN')
private readonly mailerService: EmailServiceInterface,
protected readonly mailerService: EmailServiceInterface,
) {}

public async sendMail(dto: EmailSendOptionsInterface): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-jwt/src/services/jwt-issue.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { JwtSignService } from './jwt-sign.service';

@Injectable()
export class JwtIssueService implements JwtIssueServiceInterface {
constructor(private jwtSignService: JwtSignService) {}
constructor(protected readonly jwtSignService: JwtSignService) {}

async accessToken(
...args: Parameters<JwtIssueServiceInterface['accessToken']>
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs-jwt/src/services/jwt-sign.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { JwtTokenType } from '../jwt.types';
export class JwtSignService implements JwtSignServiceInterface {
constructor(
@Inject(JWT_MODULE_JWT_ACCESS_SERVICE_TOKEN)
private jwtAccessService: JwtService,
protected readonly jwtAccessService: JwtService,
@Inject(JWT_MODULE_JWT_REFRESH_SERVICE_TOKEN)
private jwtRefreshService: JwtService,
protected readonly jwtRefreshService: JwtService,
) {}

async signAsync(
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-jwt/src/services/jwt-verify.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { JwtSignService } from './jwt-sign.service';

@Injectable()
export class JwtVerifyService implements JwtVerifyServiceInterface {
constructor(private jwtSignService: JwtSignService) {}
constructor(protected readonly jwtSignService: JwtSignService) {}

async accessToken(
...args: Parameters<JwtVerifyServiceInterface['accessToken']>
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-logger/src/logger-transport.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class LoggerTransportService {
*/
constructor(
@Inject(LOGGER_MODULE_SETTINGS_TOKEN)
private config: LoggerSettingsInterface,
protected readonly config: LoggerSettingsInterface,
) {
if (this.config?.transportLogLevel) {
this.logLevels = this.config.transportLogLevel;
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-logger/src/logger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class LoggerService
*
* @param transportService transport service
*/
constructor(private transportService: LoggerTransportService) {
constructor(protected readonly transportService: LoggerTransportService) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class LoggerSentryTransport implements LoggerTransportInterface {
*
* @param config configuration file injected
*/
constructor(private config: LoggerSentryConfigInterface) {
constructor(protected readonly config: LoggerSentryConfigInterface) {
if (!this.config) throw new Error('Sentry Config is required');

// Initialize Sentry
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-org/src/services/org-lookup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class OrgLookupService
@InjectDynamicRepository(ORG_MODULE_ORG_ENTITY_KEY)
repo: Repository<OrgEntityInterface>,
@Inject(ORG_MODULE_OWNER_LOOKUP_SERVICE_TOKEN)
private ownerLookupService: OrgOwnerLookupServiceInterface,
protected readonly ownerLookupService: OrgOwnerLookupServiceInterface,
) {
super(repo);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/nestjs-org/src/services/org-member.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export class OrgMemberService
constructor(
@InjectDynamicRepository(ORG_MODULE_ORG_MEMBER_ENTITY_KEY)
repo: Repository<OrgMemberEntityInterface>,
private orgLookupService: OrgLookupService,
private orgMemberLookupService: OrgMemberLookupService,
private orgMemberMutateService: OrgMemberMutateService,
protected readonly orgLookupService: OrgLookupService,
protected readonly orgMemberLookupService: OrgMemberLookupService,
protected readonly orgMemberMutateService: OrgMemberMutateService,
) {
super(repo);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-otp/src/services/otp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class OtpService implements OtpServiceInterface {
@Inject(OTP_MODULE_REPOSITORIES_TOKEN)
private allOtpRepos: Record<string, Repository<OtpInterface>>,
@Inject(OTP_MODULE_SETTINGS_TOKEN)
private settings: OtpSettingsInterface,
protected readonly settings: OtpSettingsInterface,
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export class PasswordCreationService
*/
constructor(
@Inject(PASSWORD_MODULE_SETTINGS_TOKEN)
private settings: PasswordSettingsInterface,
private passwordStorageService: PasswordStorageService,
private passwordValidationService: PasswordValidationService,
private passwordStrengthService: PasswordStrengthService,
protected readonly settings: PasswordSettingsInterface,
protected readonly passwordStorageService: PasswordStorageService,
protected readonly passwordValidationService: PasswordValidationService,
protected readonly passwordStrengthService: PasswordStrengthService,
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class PasswordStrengthService
*/
constructor(
@Inject(PASSWORD_MODULE_SETTINGS_TOKEN)
private settings: PasswordSettingsInterface,
protected readonly settings: PasswordSettingsInterface,
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-role/src/services/role.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { RoleServiceInterface } from '../interfaces/role-service.interface';
export class RoleService implements RoleServiceInterface {
constructor(
@Inject(ROLE_MODULE_SETTINGS_TOKEN)
private settings: RoleSettingsInterface,
protected readonly settings: RoleSettingsInterface,
@Inject(ROLE_MODULE_REPOSITORIES_TOKEN)
private allRoleRepos: Record<
string,
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs-swagger-ui/src/swagger-ui.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export class SwaggerUiService {
*/
constructor(
@Inject(SWAGGER_UI_MODULE_SETTINGS_TOKEN)
private settings: SwaggerUiSettingsInterface,
protected readonly settings: SwaggerUiSettingsInterface,
@Inject(SWAGGER_UI_MODULE_DOCUMENT_BUILDER_TOKEN)
private documentBuilder: DocumentBuilder,
protected readonly documentBuilder: DocumentBuilder,
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-user/src/services/user-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class UserCrudService extends TypeOrmCrudService<UserEntityInterface> {
*/
constructor(
@InjectDynamicRepository(USER_MODULE_USER_ENTITY_KEY)
private userRepo: Repository<UserEntityInterface>,
protected readonly userRepo: Repository<UserEntityInterface>,
) {
super(userRepo);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-user/src/services/user-mutate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class UserMutateService
constructor(
@InjectDynamicRepository(USER_MODULE_USER_ENTITY_KEY)
repo: Repository<UserEntityInterface>,
private userPasswordService: UserPasswordService,
protected readonly userPasswordService: UserPasswordService,
) {
super(repo);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs-user/src/services/user-password.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class UserPasswordService implements UserPasswordServiceInterface {
*/
constructor(
@Inject(UserLookupService)
private userLookupService: UserLookupServiceInterface,
protected readonly userLookupService: UserLookupServiceInterface,
@Inject(PasswordCreationService)
private passwordCreationService: PasswordCreationServiceInterface,
protected readonly passwordCreationService: PasswordCreationServiceInterface,
) {}

async setPassword(
Expand Down

0 comments on commit d2e6f4c

Please sign in to comment.