From 3316676091bcbb5aef419908bdb955e6558ca866 Mon Sep 17 00:00:00 2001 From: Marshall Sorenson Date: Fri, 22 Sep 2023 13:28:35 -0400 Subject: [PATCH] feat: remove default module defs --- packages/nestjs-auth-github/src/index.ts | 2 +- .../src/authentication.module-definition.ts | 2 ++ .../src/authentication.module.ts | 10 +--------- packages/nestjs-email/src/email.module.ts | 9 ++------- packages/nestjs-event/src/event.module.ts | 9 ++------- packages/nestjs-federated/src/index.ts | 2 +- packages/nestjs-logger/src/logger.module.ts | 14 +------------- packages/nestjs-org/src/org.module.ts | 10 +--------- packages/nestjs-otp/src/otp.module.ts | 6 +----- .../nestjs-password/src/password.module.ts | 17 +---------------- .../nestjs-role/src/role.module-definition.ts | 2 -- packages/nestjs-role/src/role.module.ts | 18 +----------------- 12 files changed, 14 insertions(+), 87 deletions(-) diff --git a/packages/nestjs-auth-github/src/index.ts b/packages/nestjs-auth-github/src/index.ts index be26c7353..f76174da7 100644 --- a/packages/nestjs-auth-github/src/index.ts +++ b/packages/nestjs-auth-github/src/index.ts @@ -1,3 +1,3 @@ export * from './auth-github.module'; export * from './auth-github.controller'; -export * from './dto/auth-github-login.dto' +export * from './dto/auth-github-login.dto'; diff --git a/packages/nestjs-authentication/src/authentication.module-definition.ts b/packages/nestjs-authentication/src/authentication.module-definition.ts index e70730c45..5966b07dc 100644 --- a/packages/nestjs-authentication/src/authentication.module-definition.ts +++ b/packages/nestjs-authentication/src/authentication.module-definition.ts @@ -86,6 +86,8 @@ export function createAuthenticationProviders(options: { }): Provider[] { return [ ...(options.providers ?? []), + JwtIssueService, + JwtVerifyService, createAuthenticationOptionsProvider(options.overrides), createAuthenticationVerifyTokenServiceProvider(options.overrides), createAuthenticationIssueTokenServiceProvider(options.overrides), diff --git a/packages/nestjs-authentication/src/authentication.module.ts b/packages/nestjs-authentication/src/authentication.module.ts index 1ed0c7d05..a844253fc 100644 --- a/packages/nestjs-authentication/src/authentication.module.ts +++ b/packages/nestjs-authentication/src/authentication.module.ts @@ -1,7 +1,5 @@ import { DynamicModule, Module } from '@nestjs/common'; -import { JwtIssueService, JwtVerifyService } from '@concepta/nestjs-jwt'; - import { AuthenticationAsyncOptions, AuthenticationModuleClass, @@ -11,16 +9,10 @@ import { createAuthenticationExports, } from './authentication.module-definition'; -import { IssueTokenService } from './services/issue-token.service'; -import { VerifyTokenService } from './services/verify-token.service'; - /** * Authentication module */ -@Module({ - providers: [JwtIssueService, JwtVerifyService], - exports: [IssueTokenService, VerifyTokenService], -}) +@Module({}) export class AuthenticationModule extends AuthenticationModuleClass { static register(options: AuthenticationOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-email/src/email.module.ts b/packages/nestjs-email/src/email.module.ts index d53ddb89f..630b7ef98 100644 --- a/packages/nestjs-email/src/email.module.ts +++ b/packages/nestjs-email/src/email.module.ts @@ -1,4 +1,4 @@ -import { DynamicModule, Logger, Module } from '@nestjs/common'; +import { DynamicModule, Module } from '@nestjs/common'; import { EmailAsyncOptions, @@ -9,15 +9,10 @@ import { createEmailExports, } from './email.module-definition'; -import { EmailService } from './email.service'; - /** * Email module */ -@Module({ - providers: [Logger, EmailService], - exports: [EmailService], -}) +@Module({}) export class EmailModule extends EmailModuleClass { static register(options: EmailOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-event/src/event.module.ts b/packages/nestjs-event/src/event.module.ts index 1ace35ca8..c58d9905f 100644 --- a/packages/nestjs-event/src/event.module.ts +++ b/packages/nestjs-event/src/event.module.ts @@ -1,20 +1,15 @@ -import { DynamicModule, Logger, Module } from '@nestjs/common'; +import { DynamicModule, Module } from '@nestjs/common'; import { EventAsyncOptions, EventModuleClass, EventOptions, } from './event.module-definition'; -import { EventDispatchService } from './services/event-dispatch.service'; -import { EventListenService } from './services/event-listen.service'; /** * Event module */ -@Module({ - providers: [Logger, EventListenService, EventDispatchService], - exports: [EventListenService, EventDispatchService], -}) +@Module({}) export class EventModule extends EventModuleClass { static forRoot(options: EventOptions): DynamicModule { return super.forRoot({ ...options, global: true }); diff --git a/packages/nestjs-federated/src/index.ts b/packages/nestjs-federated/src/index.ts index 9b998b593..2ac0b6b26 100644 --- a/packages/nestjs-federated/src/index.ts +++ b/packages/nestjs-federated/src/index.ts @@ -13,4 +13,4 @@ export { FederatedUserMutateServiceInterface } from './interfaces/federated-user export { FederatedDto } from './dto/federated.dto'; export { FederatedCreateDto } from './dto/federated-create.dto'; -export { FederatedUpdateDto } from './dto/federated-update.dto'; \ No newline at end of file +export { FederatedUpdateDto } from './dto/federated-update.dto'; diff --git a/packages/nestjs-logger/src/logger.module.ts b/packages/nestjs-logger/src/logger.module.ts index c1dc089a2..16853cd3c 100644 --- a/packages/nestjs-logger/src/logger.module.ts +++ b/packages/nestjs-logger/src/logger.module.ts @@ -9,11 +9,6 @@ import { createLoggerExports, } from './logger.module-definition'; -import { LoggerService } from './logger.service'; -import { LoggerTransportService } from './logger-transport.service'; -import { LoggerExceptionFilter } from './logger-exception.filter'; -import { LoggerRequestInterceptor } from './logger-request.interceptor'; - /** * Logger Module imports all configuration needed for logger and sentry * With classes for request interceptor and Exceptions filters @@ -60,14 +55,7 @@ import { LoggerRequestInterceptor } from './logger-request.interceptor'; * } * ``` */ -@Module({ - providers: [ - LoggerTransportService, - LoggerRequestInterceptor, - LoggerExceptionFilter, - ], - exports: [LoggerService], -}) +@Module({}) export class LoggerModule extends LoggerModuleClass { static register(options: LoggerOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-org/src/org.module.ts b/packages/nestjs-org/src/org.module.ts index f10848cd7..8746d9d6e 100644 --- a/packages/nestjs-org/src/org.module.ts +++ b/packages/nestjs-org/src/org.module.ts @@ -1,8 +1,4 @@ import { DynamicModule, Module } from '@nestjs/common'; -import { OrgController } from './org.controller'; -import { OrgLookupService } from './services/org-lookup.service'; -import { OrgCrudService } from './services/org-crud.service'; -import { OrgMutateService } from './services/org-mutate.service'; import { OrgAsyncOptions, OrgModuleClass, @@ -16,11 +12,7 @@ import { /** * Org Module */ -@Module({ - providers: [OrgLookupService, OrgMutateService, OrgCrudService], - exports: [OrgLookupService, OrgMutateService, OrgCrudService], - controllers: [OrgController], -}) +@Module({}) export class OrgModule extends OrgModuleClass { static register(options: OrgOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-otp/src/otp.module.ts b/packages/nestjs-otp/src/otp.module.ts index 69e234e21..363470f21 100644 --- a/packages/nestjs-otp/src/otp.module.ts +++ b/packages/nestjs-otp/src/otp.module.ts @@ -1,6 +1,5 @@ import { DynamicModule, Module } from '@nestjs/common'; -import { OtpService } from './services/otp.service'; import { OtpAsyncOptions, OtpModuleClass, @@ -13,10 +12,7 @@ import { /** * Otp Module */ -@Module({ - providers: [OtpService], - exports: [OtpService], -}) +@Module({}) export class OtpModule extends OtpModuleClass { static register(options: OtpOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-password/src/password.module.ts b/packages/nestjs-password/src/password.module.ts index 9ac31ddab..c1396500c 100644 --- a/packages/nestjs-password/src/password.module.ts +++ b/packages/nestjs-password/src/password.module.ts @@ -9,22 +9,7 @@ import { createPasswordExports, } from './password.module-definition'; -import { PasswordCreationService } from './services/password-creation.service'; -import { PasswordStorageService } from './services/password-storage.service'; -import { PasswordStrengthService } from './services/password-strength.service'; - -@Module({ - providers: [ - PasswordCreationService, - PasswordStrengthService, - PasswordStorageService, - ], - exports: [ - PasswordCreationService, - PasswordStrengthService, - PasswordStorageService, - ], -}) +@Module({}) export class PasswordModule extends PasswordModuleClass { static register(options: PasswordOptions): DynamicModule { return super.register(options); diff --git a/packages/nestjs-role/src/role.module-definition.ts b/packages/nestjs-role/src/role.module-definition.ts index 990036d5a..79bb223a9 100644 --- a/packages/nestjs-role/src/role.module-definition.ts +++ b/packages/nestjs-role/src/role.module-definition.ts @@ -96,8 +96,6 @@ export function createRoleProviders( entities: options.overrides?.entities ?? options.entities, }), RoleService, - RoleLookupService, - RoleMutateService, RoleCrudService, ]; } diff --git a/packages/nestjs-role/src/role.module.ts b/packages/nestjs-role/src/role.module.ts index 1fbc436e9..235415d6c 100644 --- a/packages/nestjs-role/src/role.module.ts +++ b/packages/nestjs-role/src/role.module.ts @@ -10,26 +10,10 @@ import { createRoleControllers, } from './role.module-definition'; -import { RoleService } from './services/role.service'; -import { RoleCrudService } from './services/role-crud.service'; -import { RoleLookupService } from './services/role-lookup.service'; -import { RoleMutateService } from './services/role-mutate.service'; -import { RoleController } from './role.controller'; -import { RoleAssignmentController } from './role-assignment.controller'; - /** * Role Module */ -@Module({ - providers: [ - RoleService, - RoleLookupService, - RoleMutateService, - RoleCrudService, - ], - exports: [RoleService, RoleLookupService, RoleMutateService, RoleCrudService], - controllers: [RoleController, RoleAssignmentController], -}) +@Module({}) export class RoleModule extends RoleModuleClass { static register(options: RoleOptions): DynamicModule { return super.register(options);