plugin-common.module.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Module } from '@nestjs/common';
  2. import { CacheModule } from '../cache/cache.module';
  3. import { ConfigModule } from '../config/config.module';
  4. import { EventBusModule } from '../event-bus/event-bus.module';
  5. import { HealthCheckModule } from '../health-check/health-check.module';
  6. import { JobQueueModule } from '../job-queue/job-queue.module';
  7. import { ServiceModule } from '../service/service.module';
  8. /**
  9. * @description
  10. * This module provides the common services, configuration, and event bus capabilities
  11. * required by a typical plugin. It should be imported into plugins to avoid having to
  12. * repeat the same boilerplate for each individual plugin.
  13. *
  14. * The PluginCommonModule exports:
  15. *
  16. * * `EventBusModule`, allowing the injection of the {@link EventBus} service.
  17. * * `ServiceModule` allowing the injection of any of the various entity services such as ProductService, OrderService etc.
  18. * * `ConfigModule`, allowing the injection of the ConfigService.
  19. * * `JobQueueModule`, allowing the injection of the {@link JobQueueService}.
  20. * * `HealthCheckModule`, allowing the injection of the {@link HealthCheckRegistryService}.
  21. *
  22. * @docsCategory plugin
  23. */
  24. @Module({
  25. imports: [
  26. EventBusModule,
  27. ConfigModule,
  28. ServiceModule.forPlugin(),
  29. JobQueueModule,
  30. HealthCheckModule,
  31. CacheModule,
  32. ],
  33. exports: [
  34. EventBusModule,
  35. ConfigModule,
  36. ServiceModule.forPlugin(),
  37. JobQueueModule,
  38. HealthCheckModule,
  39. CacheModule,
  40. ],
  41. })
  42. export class PluginCommonModule {}