hunk.code_window:   ],
     providers: [...PROVIDERS],
     exports: [...PROVIDERS, LoggerModule],
   })
   export class SharedModule {}
hunk.labels: keep keep replace keep keep
hunk.after_edit:   exports: [...PROVIDERS, LoggerModule, FeatureFlagsModule],
  
hunk.file_path: apps/api/src/app/shared/shared.module.ts
hunk.type: replace
file: import { Module } from '@nestjs/common';
  import {
    DalService,
    UserRepository,
    OrganizationRepository,
    EnvironmentRepository,
    ExecutionDetailsRepository,
    NotificationTemplateRepository,
    SubscriberRepository,
    NotificationRepository,
    MessageRepository,
    NotificationGroupRepository,
    MessageTemplateRepository,
    MemberRepository,
    LayoutRepository,
    LogRepository,
    IntegrationRepository,
    ChangeRepository,
    JobRepository,
    FeedRepository,
    SubscriberPreferenceRepository,
    TopicRepository,
    TopicSubscribersRepository,
  } from '@novu/dal';
  import {
    InMemoryProviderService,
    AnalyticsService,
    createNestLoggingModuleOptions,
    LoggerModule,
    CacheService,
    InvalidateCacheService,
    AzureBlobStorageService,
    GCSStorageService,
    S3StorageService,
    StorageService,
    WsQueueService,
    DistributedLockService,
    PerformanceService,
    TriggerQueueService,
  } from '@novu/application-generic';
  
  import * as packageJson from '../../../package.json';
  
  const DAL_MODELS = [
    UserRepository,
    OrganizationRepository,
    EnvironmentRepository,
    ExecutionDetailsRepository,
    NotificationTemplateRepository,
    SubscriberRepository,
    NotificationRepository,
    MessageRepository,
    MessageTemplateRepository,
    NotificationGroupRepository,
    MemberRepository,
    LayoutRepository,
    LogRepository,
    IntegrationRepository,
    ChangeRepository,
    JobRepository,
    FeedRepository,
    SubscriberPreferenceRepository,
    TopicRepository,
    TopicSubscribersRepository,
  ];
  
  function getStorageServiceClass() {
    switch (process.env.STORAGE_SERVICE) {
      case 'GCS':
        return GCSStorageService;
      case 'AZURE':
        return AzureBlobStorageService;
      default:
        return S3StorageService;
    }
  }
  
  const dalService = new DalService();
  
  const inMemoryProviderService = {
    provide: InMemoryProviderService,
    useFactory: (enableAutoPipelining?: boolean) => {
      return new InMemoryProviderService(enableAutoPipelining);
    },
  };
  
  const cacheService = {
    provide: CacheService,
    useFactory: () => {
      // TODO: Temporary to test in Dev. Should be removed.
      const enableAutoPipelining = process.env.REDIS_CACHE_ENABLE_AUTOPIPELINING === 'true';
      const factoryInMemoryProviderService = inMemoryProviderService.useFactory(enableAutoPipelining);
  
      return new CacheService(factoryInMemoryProviderService);
    },
  };
  
  const distributedLockService = {
    provide: DistributedLockService,
    useFactory: () => {
      const factoryInMemoryProviderService = inMemoryProviderService.useFactory();
  
      return new DistributedLockService(factoryInMemoryProviderService);
    },
  };
  
  const PROVIDERS = [
    cacheService,
    distributedLockService,
    inMemoryProviderService,
    {
      provide: WsQueueService,
      useClass: WsQueueService,
    },
    {
      provide: DalService,
      useFactory: async () => {
        await dalService.connect(process.env.MONGO_URL);
  
        return dalService;
      },
    },
    {
      provide: PerformanceService,
      useFactory: () => {
        return new PerformanceService();
      },
    },
    InvalidateCacheService,
    ...DAL_MODELS,
    {
      provide: StorageService,
      useClass: getStorageServiceClass(),
    },
    {
      provide: AnalyticsService,
      useFactory: async () => {
        const analyticsService = new AnalyticsService(process.env.SEGMENT_TOKEN);
  
        await analyticsService.initialize();
  
        return analyticsService;
      },
    },
    TriggerQueueService,
  ];
  
  @Module({
    imports: [
      LoggerModule.forRoot(
        createNestLoggingModuleOptions({
          serviceName: packageJson.name,
          version: packageJson.version,
        })
      ),
    ],
    providers: [...PROVIDERS],
    exports: [...PROVIDERS, LoggerModule],
  })
  export class SharedModule {}
  